From b8039e6d8a3e84990afca55e69e44d5b6b52f223 Mon Sep 17 00:00:00 2001 From: David Dworken Date: Fri, 21 Oct 2022 23:26:41 -0700 Subject: [PATCH] Add test for fish recording background commands + remove todo --- client/client_test.go | 4 +++- client/lib/config.fish | 2 -- client/lib/tui.go | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/client_test.go b/client/client_test.go index e27e70f..1564891 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -1600,6 +1600,8 @@ func TestFish(t *testing.T) { tmux send -t foo ls SPACE /tmp/ ENTER sleep 0.5 tmux send -t foo SPACE echo SPACE foobar ENTER + tmux send -t foo ls SPACE /bar/ SPACE '&' ENTER + sleep 0.5 sleep 0.5 tmux capture-pane -p tmux kill-session -t foo`) @@ -1608,7 +1610,7 @@ func TestFish(t *testing.T) { } out = tester.RunInteractiveShell(t, `hishtory export | grep -v pipefail | grep -v ps`) - expectedOutput := "echo foo\necho bar\nls /tmp/\n" + expectedOutput := "echo foo\necho bar\nls /tmp/\nls /bar/ &\n" if diff := cmp.Diff(expectedOutput, out); diff != "" { t.Fatalf("hishtory export mismatch (-expected +got):\n%s\nout=%#v", diff, out) } diff --git a/client/lib/config.fish b/client/lib/config.fish index bfe43ee..07d508d 100644 --- a/client/lib/config.fish +++ b/client/lib/config.fish @@ -17,8 +17,6 @@ function __hishtory_on_prompt --on-event fish_prompt end end -# TODO: support background commands, see https://github.com/fish-shell/fish-shell/issues/3894 - function __hishtory_on_control_r set -l tmp (mktemp -t fish.XXXXXX) set -x init_query (commandline -b) diff --git a/client/lib/tui.go b/client/lib/tui.go index d0a1899..cc168f7 100644 --- a/client/lib/tui.go +++ b/client/lib/tui.go @@ -92,6 +92,7 @@ func (m model) Init() tea.Cmd { } func runQueryAndUpdateTable(m model) model { + // TODO: this has the bug where if you search for x, and then hit backspace to an empty search query it won't rerun if m.runQuery != "" && m.runQuery != m.lastQuery { rows, numEntries, err := getRows(m.ctx, m.runQuery) if err != nil {