From 8c802a6e6b71f6941c5dfdf20ab178e0e84061d2 Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Thu, 27 Jan 2022 16:28:29 -0400 Subject: [PATCH] feat: dont put input in history if it starts with a space --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 2115668..5bd1cd3 100644 --- a/main.go +++ b/main.go @@ -184,6 +184,7 @@ input: // If we get a completely random error, print fmt.Fprintln(os.Stderr, err) } + oldInput := input input = strings.TrimSpace(input) if len(input) == 0 { @@ -202,7 +203,11 @@ input: } } } - handleHistory(input) + + // if input has space at the beginning, dont put in history + if !strings.HasPrefix(oldInput, " ") { + handleHistory(input) + } runInput(input) termwidth, _, err := term.GetSize(0)