fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Asuka MinatoAlso show case-insensitive prefix matches in completion pager656b39a0b

master
4.6 KiB128 linesraw
1#RUN: %fish %s
2#REQUIRES: command -v tmux
3#REQUIRES: uname -r | grep -qv Microsoft
4# disable on github actions because it's flakey
5#REQUIRES: test -z "$CI"
6
7isolated-tmux-start
8
9# Don't escape existing token (#7526).
10echo >file-1
11echo >file-2
12isolated-tmux send-keys 'HOME=$PWD ls ~/' Tab
13tmux-sleep
14isolated-tmux capture-pane -p
15# Note the contents may or may not have the autosuggestion appended - it is a race.
16# CHECK: prompt {{\d+}}> HOME=$PWD ls ~/file-{{1?}}
17# CHECK: ~/file-1  ~/file-2
18
19# No pager on single smartcase completion (#7738).
20isolated-tmux send-keys C-u C-l 'mkdir cmake CMakeFiles' Enter C-l \
21    'cat cmake' Tab
22tmux-sleep
23isolated-tmux capture-pane -p
24# CHECK: prompt {{\d+}}> cat cmake/
25# CHECK: cmake/  CMakeFiles/
26
27# Keep mixed-case completions visible when typing lowercase and ignore non-matching prefixes (#7944).
28isolated-tmux send-keys C-u C-l 'rm -rf dog Dodo Voodo' Enter \
29    'mkdir dog Dodo Voodo docker doc_internal doc_src' Enter C-l \
30    'cd do' Tab
31tmux-sleep
32isolated-tmux capture-pane -p
33# CHECK: prompt {{\d+}}> cd do{{(cker/)?}}
34# CHECK: docker/  doc_internal/  doc_src/  Dodo/  dog/
35
36# Correct case in pager when prefixes differ in case (#7743).
37isolated-tmux send-keys C-u C-l 'complete -c foo2 -a "aabc aaBd" -f' Enter C-l \
38    'foo2 A' Tab
39tmux-sleep
40isolated-tmux capture-pane -p
41# The "bc" part is the autosuggestion - we could use "capture-pane -e" to check colors.
42# CHECK: prompt {{\d+}}> foo2 aabc
43# CHECK: aabc  aaBd
44
45# Check that a larger-than-screen completion list does not stomp a multiline commandline (#8509).
46isolated-tmux send-keys C-u 'complete -c foo3 -fa "(seq $LINES)\t(string repeat -n $COLUMNS d)"' Enter \
47    C-l begin Enter foo3 Enter "echo some trailing line" \
48    C-p C-e Space Tab Tab
49tmux-sleep
50isolated-tmux capture-pane -p | sed -n '1p;$p'
51# Assert that we didn't change the command line.
52# CHECK: prompt {{\d+}}> begin
53# Also ensure that the pager is actually fully disclosed.
54# CHECK: rows 1 to {{\d+}} of {{\d+}}
55
56# Canceling the pager removes the inserted completion, no matter what happens in the search field.
57# The common prefix remains because it is inserted before the pager is shown.
58isolated-tmux send-keys C-c
59tmux-sleep
60isolated-tmux send-keys C-l foo2 Space BTab b BSpace b Escape
61tmux-sleep
62isolated-tmux capture-pane -p
63# CHECK: prompt {{\d+}}> foo2 aa
64
65# Check that down-or-search works even when the pager is not selected.
66isolated-tmux send-keys C-u foo2 Space Tab
67tmux-sleep
68isolated-tmux send-keys Down
69tmux-sleep
70isolated-tmux capture-pane -p
71# Also check that we show an autosuggestion.
72# CHECK: prompt {{\d+}}> foo2 aabc aabc
73# CHECK: aabc{{ *}}aaBd
74
75# Check that a larger-than-screen completion does not break down-or-search.
76isolated-tmux send-keys C-u 'complete -c foo4 -f -a "
77    a-long-arg-\"$(seq $LINES | string pad -c_ --width $COLUMNS)\"
78    b-short-arg"' Enter C-l foo4 Space Tab Tab Down
79tmux-sleep
80isolated-tmux capture-pane -p | head -1
81# The second one is the autosuggestion. Maybe we should turn them off for this test.
82# TODO there should be a prefix ("prompt 4> foo4") but we fail to draw that in this case.
83# CHECK: {{.*}} b-short-arg a-long-arg{{.*}}
84
85# Check that completion pager followed by token search search inserts two separate tokens.
86isolated-tmux send-keys C-u echo Space old-arg Enter C-l foo2 Space Tab Tab M-.
87tmux-sleep
88isolated-tmux capture-pane -p
89# CHECK: prompt {{\d+}}> foo2 aabc old-arg
90
91isolated-tmux send-keys C-u 'echo suggest this' Enter C-l
92tmux-sleep
93isolated-tmux send-keys 'echo sug' C-w C-z
94tmux-sleep
95isolated-tmux capture-pane -p
96# CHECK: prompt {{\d+}}> echo suggest this
97
98isolated-tmux send-keys C-u 'bind ctrl-s forward-single-char' Enter C-l
99isolated-tmux send-keys 'echo suggest thi'
100tmux-sleep
101isolated-tmux send-keys C-s
102tmux-sleep
103isolated-tmux send-keys C-s
104tmux-sleep
105isolated-tmux capture-pane -p
106# CHECK: prompt {{\d+}}> echo suggest this
107
108isolated-tmux send-keys C-u
109isolated-tmux send-keys 'echo sugg' C-a
110tmux-sleep
111isolated-tmux send-keys C-e M-f Space nothing
112tmux-sleep
113isolated-tmux capture-pane -p
114# CHECK: prompt {{\d+}}> echo suggest nothing
115
116isolated-tmux send-keys C-u 'bind \cs forward-char-passive' Enter C-l
117isolated-tmux send-keys C-u 'bind \cb backward-char-passive' Enter C-l
118isolated-tmux send-keys C-u 'echo do not accept this' Enter C-l
119tmux-sleep
120isolated-tmux send-keys 'echo do not accept thi' C-b C-b DC C-b C-s 'h'
121tmux-sleep
122isolated-tmux send-keys C-s C-s C-s 'x'
123isolated-tmux capture-pane -p
124# CHECK: prompt {{\d+}}> echo do not accept thix
125isolated-tmux send-keys C-u C-l ': {*,' Tab Tab Space ,
126tmux-sleep
127isolated-tmux capture-pane -p
128# CHECK: prompt {{\d+}}> : {*,cmake/ ,{{.*}}