fish-shell/tests/checks/tmux-history-search.fish
Johannes Altmanninger 8bf8b10f68 Extended & human-friendly keys
See the changelog additions for user-visible changes.

Since we enable/disable terminal protocols whenever we pass terminal ownership,
tests can no longer run in parallel on the same terminal.

For the same reason, readline shortcuts in the gdb REPL will not work anymore.
As a remedy, use gdbserver, or lobby for CSI u support in libreadline.

Add sleep to some tests, otherwise they fall (both in CI and locally).

There are two weird failures on FreeBSD remaining, disable them for now
https://github.com/fish-shell/fish-shell/pull/10359/checks?check_run_id=23330096362

Design and implementation borrows heavily from Kakoune.

In future, we should try to implement more of the kitty progressive
enhancements.

Closes #10359
2024-04-02 14:35:16 +02:00

67 lines
2.0 KiB
Fish

#RUN: %fish %s | %filter-ctrlseqs
#REQUIRES: command -v tmux
# disable on github actions because it's flakey
#REQUIRES: test -z "$CI"
# The default history-pager-delete binding is shift-delete which
# won't work on terminals that don't support CSI u, so rebind.
set -g isolated_tmux_fish_extra_args -C '
set -g fish_autosuggestion_enabled 0
bind alt-d history-pager-delete or backward-delete-char
'
isolated-tmux-start
isolated-tmux send-keys 'true needle' Enter
# CHECK: prompt 0> true needle
tmux-sleep
isolated-tmux send-keys 'true hay ee hay' Enter
# CHECK: prompt 1> true hay ee hay
tmux-sleep
isolated-tmux send-keys C-p C-a M-f M-f M-f M-.
# CHECK: prompt 2> true hay needle hay
tmux-sleep
isolated-tmux capture-pane -p
isolated-tmux send-keys C-e C-u true Up Up Escape
tmux-sleep
isolated-tmux capture-pane -p | grep 'prompt 2'
# CHECK: prompt 2> true
isolated-tmux send-keys C-z _
tmux-sleep
isolated-tmux capture-pane -p | grep 'prompt 2'
# CHECK: prompt 2> _
# When history pager fails to find a result, copy the search field to the command line.
isolated-tmux send-keys C-e C-u C-r "echo no such command in history"
tmux-sleep
isolated-tmux send-keys Enter
# CHECK: prompt 2> echo no such command in history
isolated-tmux capture-pane -p | grep 'prompt 2'
isolated-tmux send-keys C-c
isolated-tmux send-keys C-r hay/shmay
isolated-tmux send-keys C-w C-h
isolated-tmux send-keys Enter
# CHECK: prompt 2> true hay ee hay
isolated-tmux capture-pane -p | grep 'prompt 2>'
isolated-tmux send-keys C-c
isolated-tmux send-keys "echo sdifjsdoifjsdoifj" Enter
tmux-sleep
isolated-tmux capture-pane -p | grep "^sdifjsdoifjsdoifj\|prompt 3>"
# CHECK: sdifjsdoifjsdoifj
# CHECK: prompt 3>
isolated-tmux send-keys C-e C-u C-r
tmux-sleep
isolated-tmux send-keys "echo sdifjsdoifjsdoifj"
tmux-sleep
isolated-tmux send-keys M-d # alt-d
tmux-sleep
isolated-tmux capture-pane -p | grep "(no matches)"
# CHECK: (no matches)
isolated-tmux send-keys Enter C-e C-u "echo foo" Enter
tmux-sleep
isolated-tmux capture-pane -p | grep "^foo\|prompt 4>"
# CHECK: foo
# CHECK: prompt 4>