From 7b0b06d9bf3d8304106a6830dfaa8a24d07cb4a4 Mon Sep 17 00:00:00 2001 From: sammy <38820196+TorchedSammy@users.noreply.github.com> Date: Mon, 19 Apr 2021 22:08:16 -0400 Subject: [PATCH] fix: dont make continue prompt input include a newline --- main.go | 4 ++-- shell.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 0c44ddd..5bbae93 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ import ( "golang.org/x/term" ) -const version = "0.4.0-dev.1+hilbiline" +const version = "0.4.0-dev.2+hilbiline" var l *lua.LState // User's prompt, this will get set when lua side is initialized var prompt string @@ -146,7 +146,7 @@ func ContinuePrompt(prev string) (string, error) { } cont = strings.TrimSpace(cont) - return prev + "\n" + strings.TrimSuffix(cont, "\n"), nil + return prev + " " + strings.TrimSuffix(cont, "\n"), nil } // This semi cursed function formats our prompt (obviously) diff --git a/shell.go b/shell.go index 60e07cb..e0faf5d 100644 --- a/shell.go +++ b/shell.go @@ -159,13 +159,14 @@ func HandleHistory(cmd string) { func StartMultiline(prev string, sb *strings.Builder) bool { // sb fromt outside is passed so we can // save input from previous prompts - if sb.String() == "" { sb.WriteString(prev + "\n") } + if sb.String() == "" { sb.WriteString(prev + " ") } fmt.Print(multilinePrompt) reader := bufio.NewReader(os.Stdin) cont, err := reader.ReadString('\n') + cont = strings.TrimSuffix(cont, "\n") + " " if err == io.EOF { // Exit when ^D fmt.Println("")