Add test for fish recording background commands + remove todo

This commit is contained in:
David Dworken 2022-10-21 23:26:41 -07:00
parent 70f5d668de
commit b8039e6d8a
3 changed files with 4 additions and 3 deletions

View File

@ -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)
}

View File

@ -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)

View File

@ -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 {