mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-29 05:03:46 +08:00
b4fccb114c
This prevents leaking the escape sequence by printing nonsense, and it
also allows disabling cursor setting by just setting the variable to
e.g. empty.
And if we ever added any shapes, it would allow them to be used on new
fish and ignored on old
Fixes #9698
(cherry picked from commit e45bddcbb1
)
20 lines
408 B
Fish
20 lines
408 B
Fish
function __fish_cursor_xterm -d 'Set cursor (xterm)'
|
|
set -l shape $argv[1]
|
|
|
|
switch "$shape"
|
|
case block
|
|
set shape 2
|
|
case underscore
|
|
set shape 4
|
|
case line
|
|
set shape 6
|
|
case '*'
|
|
# Unknown shape
|
|
return
|
|
end
|
|
if contains blink $argv
|
|
set shape (math $shape - 1)
|
|
end
|
|
echo -en "\e[$shape q"
|
|
end
|