fix: return previous input on continue input error

this is basically 72973eade7
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
pull/61/head
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
1 changed files with 3 additions and 2 deletions

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
}