fork/fish-shell

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

Johannes AltmanningerFix regression causing cursor shape commands to leak into noninteractive shell495083249

master
1.2 KiB34 linesraw
1function fish_vi_cursor -d 'Set cursor shape for different vi modes'
2    set -q fish_cursor_unknown
3    or set -g fish_cursor_unknown block
4
5    function __fish_vi_cursor --argument-names varname
6        if not status is-interactive; and not status is-interactive-read
7            return
8        end
9        if not set -q $varname
10            switch $varname
11                case fish_cursor_insert
12                    __fish_cursor_xterm line
13                case fish_cursor_replace_one fish_cursor_replace
14                    __fish_cursor_xterm underscore
15                case '*'
16                    __fish_cursor_xterm $fish_cursor_unknown
17            end
18            return
19        end
20        __fish_cursor_xterm $$varname
21    end
22
23    function fish_vi_cursor_handle --on-variable fish_bind_mode --on-event fish_postexec --on-event fish_focus_in --on-event fish_read
24        __fish_vi_cursor fish_cursor_$fish_bind_mode
25    end
26
27    function fish_vi_cursor_handle_preexec --on-event fish_preexec --on-event fish_exit
28        set -l varname fish_cursor_external
29        if not set -q $varname
30            set varname fish_cursor_default
31        end
32        __fish_vi_cursor $varname
33    end
34end