fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
c3a9edcea
master
1#RUN: %fish %s 2#REQUIRES: command -v tmux 3 4isolated-tmux-start 5 6isolated-tmux send-keys\ 7'function fish_prompt; echo "prompt> "; end' Enter\ 8'if true' Enter\ 9"echo $ ( printf %050d ) " Enter\ 10"echo $ ( printf %0100d ) " Enter\ 11'e' 'n' 'd' Enter C-l 12 13isolated-tmux send-keys'if' 14tmux-sleep 15tmux-sleep 16isolated-tmux capture-pane -p| sed /if/,/end/s/^/^/ 17# CHECK: ^prompt> if true 18# CHECK: ^ echo 00000000000000000000000000000000000000000000000000 19# CHECK: ^ echo 000000000000000000000000000000000000000000000000000000000000000 20# CHECK: ^0000000000000000000000000000000000000 21# CHECK: ^ end 22 23# Enter does not invalidate autosuggestion. 24isolated-tmux send-keys' true' Enter 25tmux-sleep 26isolated-tmux capture-pane -p| sed /if/,/end/s/^/^/ 27# CHECK: ^prompt> if true 28# CHECK: ^ echo 00000000000000000000000000000000000000000000000000 29# CHECK: ^ echo 000000000000000000000000000000000000000000000000000000000000000 30# CHECK: ^0000000000000000000000000000000000000 31# CHECK: ^ end 32 33# Autosuggestion is also computed after Enter. 34isolated-tmux send-keys C-u C-u C-u'if true' Enter 35tmux-sleep 36isolated-tmux capture-pane -p\; send-keys C-u C-u C-u C-l| sed /if/,/end/s/^/^/ 37# CHECK: ^prompt> if true 38# CHECK: ^ echo 00000000000000000000000000000000000000000000000000 39# CHECK: ^ echo 000000000000000000000000000000000000000000000000000000000000000 40# CHECK: ^0000000000000000000000000000000000000 41# CHECK: ^ end 42 43# Test smaller windows; only the lines that fit will be shown. 44isolated-tmux send-keys'if' \; resize-window -y4 45tmux-sleep 46isolated-tmux capture-pane -p| sed s/^/^/ 47# CHECK: ^prompt> if true 48# CHECK: ^ echo 00000000000000000000000000000000000000000000000000 49# CHECK: ^ echo 000000000000000000000000000000000000000000000000000000000000000 50# CHECK: ^0000000000000000000000000000000000000… 51 52# The ellipsis means that we'll get more lines. 53isolated-tmux resize-window -y3 54tmux-sleep 55isolated-tmux capture-pane -p| sed s/^/^/ 56# CHECK: ^prompt> if true 57# CHECK: ^ echo 00000000000000000000000000000000000000000000000000 58# CHECK: ^ echo 00000000000000000000000000000000000000000000000000000000000000… 59 60# Test that truncation also works after the resize. 61isolated-tmux send-keys C-u if 62tmux-sleep 63isolated-tmux capture-pane -p| sed s/^/^/ 64# CHECK: ^prompt> if true 65# CHECK: ^ echo 00000000000000000000000000000000000000000000000000 66# CHECK: ^ echo 00000000000000000000000000000000000000000000000000000000000000… 67 68# Test that we truncate such that the prompt is never pushed up. 69isolated-tmux resize-window -y5 \; send-keys C-u Enter if 70tmux-sleep 71isolated-tmux capture-pane -p| sed s/^/^/ 72# CHECK: ^prompt> 73# CHECK: ^prompt> if true 74# CHECK: ^ echo 00000000000000000000000000000000000000000000000000 75# CHECK: ^ echo 000000000000000000000000000000000000000000000000000000000000000 76# CHECK: ^0000000000000000000000000000000000000… 77 78# Again, we take all or nothing from a soft-wrapped line. 79isolated-tmux send-keys C-u Enter if 80tmux-sleep 81isolated-tmux capture-pane -p| sed s/^/^/ 82# CHECK: ^prompt> 83# CHECK: ^prompt> 84# CHECK: ^prompt> if true 85# CHECK: ^ echo 00000000000000000000000000000000000000000000000000 86# CHECK: ^ echo 00000000000000000000000000000000000000000000000000000000000000… 87 88# Now try with a multiline prompt. 89isolated-tmux send-keys C-u'function fish_prompt; printf "prompt-line%d/2> \n" 1 2; end' Enter C-l Enter if 90tmux-sleep 91isolated-tmux capture-pane -p| sed s/^/^/ 92# CHECK: ^prompt-line1/2> 93# CHECK: ^prompt-line2/2> 94# CHECK: ^prompt-line1/2> 95# CHECK: ^prompt-line2/2> if true 96# CHECK: ^ echo 00000000000000000000000000000000000000000000000000… 97 98isolated-tmux send-keys C-u\; resize-window -y6 \; send-keys if 99tmux-sleep 100isolated-tmux capture-pane -p| sed s/^/^/ 101# CHECK: ^prompt-line1/2> 102# CHECK: ^prompt-line2/2> 103# CHECK: ^prompt-line1/2> 104# CHECK: ^prompt-line2/2> if true 105# CHECK: ^ echo 00000000000000000000000000000000000000000000000000 106# CHECK: ^ echo 000000000000000000000000000000000000000000000000000000… 107 108isolated-tmux send-keys C-u\; resize-window -y7 \; send-keys if 109tmux-sleep 110isolated-tmux capture-pane -p| sed s/^/^/ 111# CHECK: ^prompt-line1/2> 112# CHECK: ^prompt-line2/2> 113# CHECK: ^prompt-line1/2> 114# CHECK: ^prompt-line2/2> if true 115# CHECK: ^ echo 00000000000000000000000000000000000000000000000000 116# CHECK: ^ echo 0000000000000000000000000000000000000000000000000000000 117# CHECK: ^000000000000000000000000000000000000000000000… 118 119# Autosuggestion with a line that barely wraps. 120isolated-tmux resize-window -x80 -y4 \; send-keys C-u\ 121'function fish_prompt; printf "prompt-line1\n> "; end' Enter\ 122 b e g i n Enter\ 123# prompt=2 command=2 indent=4 124": $ ( printf %072d ) " Enter\ 125 Enter\ 126 Enter\ 127 Enter\ 128 e n d Enter C-l b e g i n 129tmux-sleep 130isolated-tmux capture-pane -p| sed s/^/^/ 131# CHECK: ^prompt-line1 132# CHECK: ^> begin 133# CHECK: ^ : 000000000000000000000000000000000000000000000000000000000000000000000000 134# CHECK: ^… 135 136# Autosuggestions on a soft-wrapped commandline don't push the prompt. 137isolated-tmux resize-window -x6 -y4 \; send-keys C-u\ 138'function fish_prompt; printf "> "; end' Enter\ 139'echo l1 \\' Enter'indented line continuation' Enter\ 140 C-l Enter'e' 141tmux-sleep 142isolated-tmux capture-pane -p| sed s/^/^/ 143# CHECK: ^> 144# CHECK: ^> echo 145# CHECK: ^ l1 \… 146# CHECK: ^ 147 148isolated-tmux resize-window -x6 -y4 \; send-keys C-u\ 149'function fish_prompt; printf "> "; end' Enter\ 150'echo wrapped \\' Enter\ 151'l1 \\' Enter\ 152'l2 \\' Enter\ 153'l3' Enter\ 154 Enter Enter\ 155'echo' 156tmux-sleep 157isolated-tmux capture-pane -p| sed s/^/^/ 158# CHECK: ^> 159# CHECK: ^> 160# CHECK: ^> echo 161# CHECK: ^ wrap…