1#RUN: %fish -C 'set -g fish %fish' %s
2#REQUIRES: command -v tmux
3
4# Isolated tmux.
5set -g tmpdir (mktemp -d)
6set -g tmux tmux -S $tmpdir/.tmux-socket -f /dev/null
7
8set -g sleep sleep .1
9set -q CI && set sleep sleep 1
10
11set fish (builtin realpath $fish)
12cd $tmpdir
13
14$tmux new-session -x 80 -y 10 -d $fish -C '
15    # This is similar to "tests/interactive.config".
16    function fish_greeting; end
17    function fish_prompt; printf "prompt $status_generation> "; end
18    # No autosuggestion from older history.
19    set fish_history ""
20'
21$sleep # Let fish draw a prompt.
22
23# Don't escape existing token (#7526).
24echo >file-1
25echo >file-2
26$tmux send-keys 'HOME=$PWD ls ~/' Tab
27$sleep
28$tmux capture-pane -p
29# Note the contents may or may not have the autosuggestion appended - it is a race.
30# CHECK: prompt 0> HOME=$PWD ls ~/file-{{1?}}
31# CHECK: ~/file-1  ~/file-2
32
33# No pager on single smartcase completion (#7738).
34$tmux send-keys C-u C-l 'mkdir cmake CMakeFiles' Enter C-l \
35    'cat cmake' Tab
36$sleep
37$tmux capture-pane -p
38# CHECK: prompt 1> cat cmake/
39
40# Correct case in pager when prefixes differ in case (#7743).
41$tmux send-keys C-u C-l 'complete -c foo2 -a "aabc aaBd" -f' Enter C-l \
42    'foo2 A' Tab
43$sleep
44$tmux capture-pane -p
45# The "bc" part is the autosuggestion - we could use "tmux capture-pane -e" to check colors.
46# CHECK: prompt 2> foo2 aabc
47# CHECK: aabc  aaBd
48
49$tmux kill-server
50rm -r $tmpdir
51