check if $fish_color_cancel is set before using it

This commit is contained in:
Kurtis Rader 2017-07-04 13:23:26 -07:00
parent e4aedcd22c
commit 2df89f4b0f

View file

@ -3,7 +3,11 @@ function __fish_cancel_commandline
set -l cmd (commandline)
if test -n "$cmd"
commandline -C 1000000
if set -q fish_color_cancel
echo -ns (set_color $fish_color_cancel) "^C" (set_color normal)
else
echo -ns "^C"
end
if command -sq tput
# Clear to EOL (to erase any autosuggestion).
echo -n (tput el; or tput ce)