2
2
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:
sammyette 2021-06-11 18:08:31 -04:00
parent 03b98bdd26
commit 5b03b3cef4
No known key found for this signature in database
GPG Key ID: 50EE40A2809851F5

View File

@ -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
}