mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 20:33:08 +00:00
change cancel_commandline function to use color from variable
This allows the user to define how they want the "^C" rendered when a pending command line is interrupted.
This commit is contained in:
parent
a9db99ac52
commit
349eff0df7
3 changed files with 8 additions and 9 deletions
|
@ -918,6 +918,8 @@ The following variables are available to change the highlighting colors in fish:
|
|||
|
||||
- `fish_color_host`, the color used to print the current host system in some of fish default prompts
|
||||
|
||||
- `fish_color_cancel`, the color for the '^C' indicator on a canceled command
|
||||
|
||||
Additionally, the following variables are available to change the highlighting in the completion pager:
|
||||
|
||||
- `fish_pager_color_prefix`, the color of the prefix string, i.e. the string that is to be completed
|
||||
|
|
|
@ -3,16 +3,10 @@ function __fish_cancel_commandline
|
|||
set -l cmd (commandline)
|
||||
if test -n "$cmd"
|
||||
commandline -C 1000000
|
||||
# TODO: Switch from using tput and standout mode to `set_color` when themes have been
|
||||
# augmented to include support for background colors or has support for standout/reverse
|
||||
# mode.
|
||||
#
|
||||
# Set reverse fg/bg color mode, output ^C, restore normal mode, clear to EOL (to erase any
|
||||
# autosuggestion).
|
||||
echo -ns (set_color $fish_color_cancel) "^C" (set_color normal)
|
||||
if command -sq tput
|
||||
echo -ns (set_color -r) "^C" (set_color normal) (tput el; or tput ce)
|
||||
else
|
||||
echo -n "^C"
|
||||
# Clear to EOL (to erase any autosuggestion).
|
||||
echo -n (tput el; or tput ce)
|
||||
end
|
||||
for i in (seq (commandline -L))
|
||||
echo ""
|
||||
|
|
|
@ -86,6 +86,9 @@ function __fish_config_interactive -d "Initializations that should be performed
|
|||
set -q fish_color_selection
|
||||
or set -U fish_color_selection white --bold --background=brblack
|
||||
|
||||
set -q fish_color_cancel
|
||||
or set -U fish_color_cancel -r
|
||||
|
||||
# Pager colors
|
||||
set -q fish_pager_color_prefix
|
||||
or set -U fish_pager_color_prefix white --bold --underline
|
||||
|
|
Loading…
Reference in a new issue