mirror of
https://github.com/Hilbis/Hilbish
synced 2025-04-02 19:53:23 +00:00
fix: return previous input on continue input error
this is basically 72973eade78eb313a255b582112318b31ba9f473 but it actually works and doesnt break everything if an error occurred with the ContinuePrompt function (in this case, the error is simply EOL/ctrl d) then return previous input alone
This commit is contained in:
parent
03b98bdd26
commit
5b03b3cef4
5
main.go
5
main.go
@ -183,13 +183,14 @@ func main() {
|
||||
func ContinuePrompt(prev string) (string, error) {
|
||||
hooks.Em.Emit("multiline", nil)
|
||||
lr.SetPrompt(multilinePrompt)
|
||||
|
||||
cont, err := lr.Read()
|
||||
if err != nil {
|
||||
fmt.Println("")
|
||||
return "", err
|
||||
return prev, err
|
||||
}
|
||||
cont = strings.TrimSpace(cont)
|
||||
|
||||
cont = strings.TrimSpace(cont)
|
||||
return prev + strings.TrimSuffix(cont, "\n"), nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user