fork/fish-shell

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

Johannes AltmanningerMulti-line autosuggestionsa772470b7

master
2.0 KiB89 linesraw
1#RUN: %fish %s
2#REQUIRES: command -v tmux
3
4isolated-tmux-start -C '
5    function fish_prompt
6        if set -q transient
7            printf "> "
8            set --erase transient
9        else
10            printf "> full prompt > "
11        end
12    end
13    bind ctrl-x "set transient true; commandline -f repaint execute"
14'
15
16isolated-tmux send-keys 'echo foo' C-x
17tmux-sleep
18isolated-tmux capture-pane -p
19# CHECK: > echo foo
20# CHECK: foo
21# CHECK: > full prompt >
22
23# Regression test for transient prompt with single-line prompts.
24isolated-tmux send-keys C-u '
25    set -g fish_transient_prompt 1
26    function fish_prompt
27        printf "\$ "
28    end
29'
30tmux-sleep
31isolated-tmux send-keys C-l Enter Enter
32tmux-sleep
33isolated-tmux capture-pane -p
34# CHECK: $
35# CHECK: $
36# CHECK: $
37
38# Test that multi-line transient are properly cleared.
39isolated-tmux send-keys C-u C-l '
40    function fish_prompt
41        if contains -- --final-rendering $argv
42            printf "final line%d\n" 1 2
43        else
44            printf "transient line%d\n" 1 2
45        end
46    end
47'
48tmux-sleep
49isolated-tmux send-keys C-l Enter
50tmux-sleep
51isolated-tmux capture-pane -p
52# CHECK: final line1
53# CHECK: final line2
54# CHECK: transient line1
55# CHECK: transient line2
56
57# Test that multi-line initial prompt is properly cleared with single-line
58# final.
59isolated-tmux send-keys C-u C-l '
60    function fish_prompt
61        if contains -- --final-rendering $argv
62            echo "2> "
63        else
64            echo "transient prompt line"
65            echo "1> "
66        end
67    end
68'
69tmux-sleep
70isolated-tmux send-keys C-l 'echo foo' Enter
71tmux-sleep
72isolated-tmux capture-pane -p
73# CHECK: 2> echo foo
74# CHECK: foo
75# CHECK: transient prompt line
76# CHECK: 1>
77
78# Test that multi-line initial prompt is properly cleared with single-line
79# final.
80isolated-tmux send-keys C-u C-l
81isolated-tmux send-keys 'echo foo \\' Enter
82isolated-tmux send-keys bar Enter
83tmux-sleep
84isolated-tmux capture-pane -p
85# CHECK: 2> echo foo \
86# CHECK:        bar
87# CHECK: foo bar
88# CHECK: transient prompt line
89# CHECK: 1>