diff --git a/client/client_test.go b/client/client_test.go index 3e2b8be..1f29813 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -2114,6 +2114,14 @@ func testTui_search(t *testing.T, onlineStatus OnlineStatus) { "'\"'foo:bar'\"'", })) testutils.CompareGoldens(t, out, "TestTui-SearchColonDoubleQuoted") + + // And check that we can quote dashes + require.NoError(t, db.Create(testutils.MakeFakeHistoryEntry("foo --bar")).Error) + out = stripTuiCommandPrefix(t, captureTerminalOutput(t, tester, []string{ + "hishtory SPACE tquery ENTER", + "'\"'--bar'\"'", + })) + testutils.CompareGoldens(t, out, "TestTui-SearchQuoteDash") } func testTui_general(t *testing.T, onlineStatus OnlineStatus) { diff --git a/client/lib/lib.go b/client/lib/lib.go index defc664..ec984f4 100644 --- a/client/lib/lib.go +++ b/client/lib/lib.go @@ -995,9 +995,7 @@ func splitEscaped(query string, separator rune, maxSplit int) []string { token = append(token, runeQuery[i]) } } - if string(token) != "" { - tokens = append(tokens, string(token)) - } + tokens = append(tokens, string(token)) return tokens }