diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f3c45f12d..dd222b53a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -69,6 +69,9 @@ Improved terminal support ^^^^^^^^^^^^^^^^^^^^^^^^^ - Support for curly underlines in `fish_color_*` variables and :doc:`set_color ` (:issue:`10957`). - Underlines can now be colored independent of text (:issue:`7619`). +- Errors are now highlighted with curly underlines in the default themes. + For compatibility with terminals that interpret the curly-underline escape sequence in an unexpected way, + the default themes enable this only if the terminal advertises support for the ``Su`` capability via XTGETTCAP. - New documentation page `Terminal Compatibility `_ (also accessible via ``man fish-terminal-compatibility``) lists required and optional terminal control sequences used by fish. - :doc:`status ` learned the ``xtgettcap`` subcommand, to query terminfo capabilities via XTGETTCAP commands. - :doc:`status ` learned the ``xtversion`` subcommand, to show the terminal's name and version (as reported by via the XTVERSION command). diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 4874831df..7d81a1f28 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -30,7 +30,7 @@ if status is-interactive # Commands to run in interactive sessions can go here end" >$__fish_config_dir/config.fish - echo yes | fish_config theme save "fish default" --track + fish_config theme save "fish default" --yes --track set -Ue fish_color_keyword fish_color_option end if test $__fish_initialized -lt 3800 && test "$fish_color_search_match[1]" = bryellow diff --git a/share/functions/__fish_in_gnu_screen.fish b/share/functions/__fish_in_gnu_screen.fish new file mode 100644 index 000000000..a95664889 --- /dev/null +++ b/share/functions/__fish_in_gnu_screen.fish @@ -0,0 +1,3 @@ +function __fish_in_gnu_screen + test -n "$STY" || contains -- $TERM screen screen-256color +end diff --git a/share/functions/__fish_in_terminal_multiplexer.fish b/share/functions/__fish_in_terminal_multiplexer.fish new file mode 100644 index 000000000..22b3cc363 --- /dev/null +++ b/share/functions/__fish_in_terminal_multiplexer.fish @@ -0,0 +1,9 @@ +function __fish_in_terminal_multiplexer + set -l terminal_name "(status xtversion | string match -r '^\S*')" + string match -q -- tmux $terminal_name || + __fish_in_gnu_screen || + # Emacs does probably not support multiplexing between multiple parent + # terminals, but it is affected by the same issues. Same for Vim's + # :terminal TODO detect that before they implement XTGETTCAP. + contains -- $TERM dvtm-256color eterm eterm-color +end diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index 19e624f4c..3eef69f03 100644 --- a/share/functions/__fish_shared_key_bindings.fish +++ b/share/functions/__fish_shared_key_bindings.fish @@ -78,9 +78,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod bind --preset $argv alt-o __fish_preview_current_file bind --preset $argv alt-w __fish_whatis_current_token bind --preset $argv ctrl-l ( - if test -z "$STY" - and not string match -qr -- '^(screen|screen-256color)$' $TERM - and __fish_xtgettcap indn + if not __fish_in_gnu_screen && and __fish_xtgettcap indn echo scrollback-push end ) clear-screen diff --git a/share/functions/fish_config.fish b/share/functions/fish_config.fish index 743e69577..997907927 100644 --- a/share/functions/fish_config.fish +++ b/share/functions/fish_config.fish @@ -5,7 +5,7 @@ function fish_config --description "Launch fish's web based configuration" \ --inherit-variable theme_var_filter set -l _flag_track - argparse h/help track -- $argv + argparse h/help track yes -- $argv or return if set -q _flag_help @@ -20,6 +20,10 @@ function fish_config --description "Launch fish's web based configuration" \ echo >&2 fish_config: --track: unknown option return 1 end + if set -q _flag_yes[1] && not { contains "$cmd" prompt theme && test "$argv[1]" = save } + echo >&2 fish_config: --yes: unknown option + return 1 + end set -q cmd[1] or set cmd browse @@ -152,8 +156,8 @@ function fish_config --description "Launch fish's web based configuration" \ functions --erase fish_right_prompt end case save - read -P"Overwrite prompt? [y/N]" -l yesno - if string match -riq 'y(es)?' -- $yesno + if set -q _flag_yes[1] || + { read -P"Overwrite prompt? [y/N]" -l yesno; string match -riq 'y(es)?' -- $yesno } echo Overwriting # Skip the cp if unnecessary, # or we'd throw an error on a stock fish. @@ -282,8 +286,10 @@ function fish_config --description "Launch fish's web based configuration" \ set -l have_colors if contains -- $cmd save - read -P"Overwrite your current theme? [y/N] " -l yesno - if not string match -riq 'y(es)?' -- $yesno + if not set -q _flag_yes && + { read -P"Overwrite your current theme? [y/N] " -l yesno + not string match -riq 'y(es)?' -- $yesno + } echo Not overwriting >&2 return 1 end @@ -362,10 +368,14 @@ function __fish_config_theme_get set -l dirs $__fish_config_dir/themes $__fish_data_dir/tools/web_config/themes set -l files $dirs/$argv[1].theme set -l file + set -l is_default_theme false for f in $files if test -e "$f" set file $f + if test $f = $__fish_data_dir/tools/web_config/themes/$argv[1].theme + set is_default_theme true + end break end end @@ -373,6 +383,7 @@ function __fish_config_theme_get if not set -q file[1] if status list-files tools/web_config/themes/$argv[1].theme &>/dev/null set file tools/web_config/themes/$argv[1].theme + set is_default_theme true else echo "No such theme: $argv[1]" >&2 echo "Searched directories: $dirs" >&2 @@ -380,11 +391,18 @@ function __fish_config_theme_get end end - if string match -qr '^tools/' -- $file - status get-file $file - else - string join \n <$file + set -l content ( + if string match -qr '^tools/' -- $file + status get-file $file + else + string join \n <$file + end + ) + if $is_default_theme && not __fish_in_gnu_screen && not __fish_xtgettcap Su && not __fish_in_terminal_multiplexer + set content (string replace -- --underline=curly "" $content) end + + string join \n $content end function __fish_config_show_tracked_color_vars diff --git a/share/tools/web_config/themes/Base16 Default Dark.theme b/share/tools/web_config/themes/Base16 Default Dark.theme index fe95277c7..7f42441a5 100644 --- a/share/tools/web_config/themes/Base16 Default Dark.theme +++ b/share/tools/web_config/themes/Base16 Default Dark.theme @@ -10,7 +10,7 @@ fish_color_comment f7ca88 fish_color_cwd green fish_color_cwd_root red fish_color_end ba8baf -fish_color_error ab4642 +fish_color_error ab4642 --underline=curly fish_color_escape 86c1b9 fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/Base16 Default Light.theme b/share/tools/web_config/themes/Base16 Default Light.theme index 842a051d1..7fc54435f 100644 --- a/share/tools/web_config/themes/Base16 Default Light.theme +++ b/share/tools/web_config/themes/Base16 Default Light.theme @@ -10,7 +10,7 @@ fish_color_comment f7ca88 fish_color_cwd green fish_color_cwd_root red fish_color_end ba8baf -fish_color_error ab4642 +fish_color_error ab4642 --underline=curly fish_color_escape 86c1b9 fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/Base16 Eighties.theme b/share/tools/web_config/themes/Base16 Eighties.theme index d2f06d96e..4bd93d251 100644 --- a/share/tools/web_config/themes/Base16 Eighties.theme +++ b/share/tools/web_config/themes/Base16 Eighties.theme @@ -10,7 +10,7 @@ fish_color_comment ffcc66 fish_color_cwd green fish_color_cwd_root red fish_color_end cc99cc -fish_color_error f2777a +fish_color_error f2777a --underline=curly fish_color_escape 66cccc fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/Bay Cruise.theme b/share/tools/web_config/themes/Bay Cruise.theme index c07f35a77..f6fd7799f 100644 --- a/share/tools/web_config/themes/Bay Cruise.theme +++ b/share/tools/web_config/themes/Bay Cruise.theme @@ -9,7 +9,7 @@ fish_color_comment FF9640 fish_color_cwd green fish_color_cwd_root red fish_color_end FFB273 -fish_color_error FF7400 +fish_color_error FF7400 --underline=curly fish_color_escape 00a6b2 fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/Dracula.theme b/share/tools/web_config/themes/Dracula.theme index ca943f1e4..e49ad699d 100644 --- a/share/tools/web_config/themes/Dracula.theme +++ b/share/tools/web_config/themes/Dracula.theme @@ -21,7 +21,7 @@ fish_color_comment 6272a4 fish_color_cwd 50fa7b fish_color_cwd_root red fish_color_end ffb86c -fish_color_error ff5555 +fish_color_error ff5555 --underline=curly fish_color_escape ff79c6 fish_color_history_current --bold fish_color_host bd93f9 diff --git a/share/tools/web_config/themes/Fairground.theme b/share/tools/web_config/themes/Fairground.theme index cb62017ad..02b1ac7db 100644 --- a/share/tools/web_config/themes/Fairground.theme +++ b/share/tools/web_config/themes/Fairground.theme @@ -9,7 +9,7 @@ fish_color_comment FFE100 fish_color_cwd green fish_color_cwd_root red fish_color_end 8D003B -fish_color_error EC3B86 +fish_color_error EC3B86 --underline=curly fish_color_escape 00a6b2 fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/Just a Touch.theme b/share/tools/web_config/themes/Just a Touch.theme index 07f3f5e17..865a98a67 100644 --- a/share/tools/web_config/themes/Just a Touch.theme +++ b/share/tools/web_config/themes/Just a Touch.theme @@ -9,7 +9,7 @@ fish_color_comment B0B0B0 fish_color_cwd green fish_color_cwd_root red fish_color_end 969696 -fish_color_error FFA779 +fish_color_error FFA779 --underline=curly fish_color_escape 00a6b2 fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/Lava.theme b/share/tools/web_config/themes/Lava.theme index b52743aad..38a115107 100644 --- a/share/tools/web_config/themes/Lava.theme +++ b/share/tools/web_config/themes/Lava.theme @@ -6,7 +6,7 @@ fish_color_command FF9400 fish_color_quote BF9C30 fish_color_redirection BF5B30 fish_color_end FF4C00 -fish_color_error FFDD73 +fish_color_error FFDD73 --underline=curly fish_color_param FFC000 fish_color_comment A63100 fish_color_selection white --background=brblack --bold diff --git a/share/tools/web_config/themes/Mono Lace.theme b/share/tools/web_config/themes/Mono Lace.theme index c53f38596..f9276568b 100644 --- a/share/tools/web_config/themes/Mono Lace.theme +++ b/share/tools/web_config/themes/Mono Lace.theme @@ -9,7 +9,7 @@ fish_color_comment 4e4e4e fish_color_cwd green fish_color_cwd_root red fish_color_end 767676 -fish_color_error b2b2b2 +fish_color_error b2b2b2 --underline=curly fish_color_escape 00a6b2 fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/Mono Smoke.theme b/share/tools/web_config/themes/Mono Smoke.theme index 4f7788556..ffd974b28 100644 --- a/share/tools/web_config/themes/Mono Smoke.theme +++ b/share/tools/web_config/themes/Mono Smoke.theme @@ -6,7 +6,7 @@ fish_color_command ffffff fish_color_quote a8a8a8 fish_color_redirection 808080 fish_color_end 949494 -fish_color_error 585858 +fish_color_error 585858 --underline=curly fish_color_param d7d7d7 fish_color_comment bcbcbc fish_color_selection white --background=brblack --bold diff --git a/share/tools/web_config/themes/None.theme b/share/tools/web_config/themes/None.theme index d615ad3a5..947a47d6b 100644 --- a/share/tools/web_config/themes/None.theme +++ b/share/tools/web_config/themes/None.theme @@ -9,7 +9,7 @@ fish_color_comment fish_color_cwd normal fish_color_cwd_root normal fish_color_end -fish_color_error +fish_color_error --underline=curly fish_color_escape fish_color_history_current fish_color_host normal diff --git a/share/tools/web_config/themes/Nord.theme b/share/tools/web_config/themes/Nord.theme index ff43c356e..cb9dd3ce0 100644 --- a/share/tools/web_config/themes/Nord.theme +++ b/share/tools/web_config/themes/Nord.theme @@ -11,7 +11,7 @@ fish_color_comment 4c566a --italics fish_color_cwd 5e81ac fish_color_cwd_root bf616a fish_color_end 81a1c1 -fish_color_error bf616a +fish_color_error bf616a --underline=curly fish_color_escape ebcb8b fish_color_history_current e5e9f0 --bold fish_color_host a3be8c diff --git a/share/tools/web_config/themes/Old School.theme b/share/tools/web_config/themes/Old School.theme index 819dd7a9c..f7ba36201 100644 --- a/share/tools/web_config/themes/Old School.theme +++ b/share/tools/web_config/themes/Old School.theme @@ -9,7 +9,7 @@ fish_color_comment 30BE30 fish_color_cwd green fish_color_cwd_root red fish_color_end FF7B7B -fish_color_error A40000 +fish_color_error A40000 --underline=curly fish_color_escape 00a6b2 fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/Seaweed.theme b/share/tools/web_config/themes/Seaweed.theme index 3a84d72ab..bc9f4cac8 100644 --- a/share/tools/web_config/themes/Seaweed.theme +++ b/share/tools/web_config/themes/Seaweed.theme @@ -9,7 +9,7 @@ fish_color_comment 5C9900 fish_color_cwd green fish_color_cwd_root red fish_color_end 8EEB00 -fish_color_error 60B9CE +fish_color_error 60B9CE --underline=curly fish_color_escape 00a6b2 fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/Snow Day.theme b/share/tools/web_config/themes/Snow Day.theme index cf98b3144..e4912afa0 100644 --- a/share/tools/web_config/themes/Snow Day.theme +++ b/share/tools/web_config/themes/Snow Day.theme @@ -6,7 +6,7 @@ fish_color_command 164CC9 fish_color_quote 4C3499 fish_color_redirection 248E8E fish_color_end 02BDBD -fish_color_error 9177E5 +fish_color_error 9177E5 --underline=curly fish_color_param 4319CC fish_color_comment 007B7B fish_color_selection white --background=brblack --bold diff --git a/share/tools/web_config/themes/Solarized Dark.theme b/share/tools/web_config/themes/Solarized Dark.theme index 84493d2d2..aaea5d14f 100644 --- a/share/tools/web_config/themes/Solarized Dark.theme +++ b/share/tools/web_config/themes/Solarized Dark.theme @@ -10,7 +10,7 @@ fish_color_comment 586e75 fish_color_cwd green fish_color_cwd_root red fish_color_end 268bd2 -fish_color_error dc322f +fish_color_error dc322f --underline=curly fish_color_escape 00a6b2 fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/Solarized Light.theme b/share/tools/web_config/themes/Solarized Light.theme index 6f1de058f..d11e5bd6c 100644 --- a/share/tools/web_config/themes/Solarized Light.theme +++ b/share/tools/web_config/themes/Solarized Light.theme @@ -7,7 +7,7 @@ fish_color_command 586e75 fish_color_quote 839496 fish_color_redirection 6c71c4 fish_color_end 268bd2 -fish_color_error dc322f +fish_color_error dc322f --underline=curly fish_color_param 657b83 fish_color_comment 93a1a1 fish_color_selection white --background=brblack --bold diff --git a/share/tools/web_config/themes/Tomorrow Night Bright.theme b/share/tools/web_config/themes/Tomorrow Night Bright.theme index 3dffc7daf..00dc49613 100644 --- a/share/tools/web_config/themes/Tomorrow Night Bright.theme +++ b/share/tools/web_config/themes/Tomorrow Night Bright.theme @@ -10,7 +10,7 @@ fish_color_comment e7c547 fish_color_cwd green fish_color_cwd_root red fish_color_end c397d8 -fish_color_error d54e53 +fish_color_error d54e53 --underline=curly fish_color_escape 00a6b2 fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/Tomorrow Night.theme b/share/tools/web_config/themes/Tomorrow Night.theme index 17d371622..06d82a800 100644 --- a/share/tools/web_config/themes/Tomorrow Night.theme +++ b/share/tools/web_config/themes/Tomorrow Night.theme @@ -7,7 +7,7 @@ fish_color_command b294bb fish_color_quote b5bd68 fish_color_redirection 8abeb7 fish_color_end b294bb -fish_color_error cc6666 +fish_color_error cc6666 --underline=curly fish_color_param 81a2be fish_color_comment f0c674 fish_color_selection white --background=brblack --bold diff --git a/share/tools/web_config/themes/Tomorrow.theme b/share/tools/web_config/themes/Tomorrow.theme index f84d95652..742e5f039 100644 --- a/share/tools/web_config/themes/Tomorrow.theme +++ b/share/tools/web_config/themes/Tomorrow.theme @@ -10,7 +10,7 @@ fish_color_comment eab700 fish_color_cwd green fish_color_cwd_root red fish_color_end 8959a8 -fish_color_error c82829 +fish_color_error c82829 --underline=curly fish_color_escape 00a6b2 fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/ayu Dark.theme b/share/tools/web_config/themes/ayu Dark.theme index 65737b1bb..175db47e7 100644 --- a/share/tools/web_config/themes/ayu Dark.theme +++ b/share/tools/web_config/themes/ayu Dark.theme @@ -7,7 +7,7 @@ fish_color_command 39BAE6 fish_color_quote C2D94C fish_color_redirection FFEE99 fish_color_end F29668 -fish_color_error FF3333 +fish_color_error FF3333 --underline=curly fish_color_param B3B1AD fish_color_comment 626A73 fish_color_selection --background=E6B450 --bold diff --git a/share/tools/web_config/themes/ayu Light.theme b/share/tools/web_config/themes/ayu Light.theme index b2cfa2446..8fc78f624 100644 --- a/share/tools/web_config/themes/ayu Light.theme +++ b/share/tools/web_config/themes/ayu Light.theme @@ -10,7 +10,7 @@ fish_color_comment ABB0B6 fish_color_cwd 399EE6 fish_color_cwd_root red fish_color_end ED9366 -fish_color_error F51818 +fish_color_error F51818 --underline=curly fish_color_escape 4CBF99 fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/ayu Mirage.theme b/share/tools/web_config/themes/ayu Mirage.theme index 626b4a543..1b2029e79 100644 --- a/share/tools/web_config/themes/ayu Mirage.theme +++ b/share/tools/web_config/themes/ayu Mirage.theme @@ -10,7 +10,7 @@ fish_color_comment 5C6773 fish_color_cwd 73D0FF fish_color_cwd_root red fish_color_end F29E74 -fish_color_error FF3333 +fish_color_error FF3333 --underline=curly fish_color_escape 95E6CB fish_color_history_current --bold fish_color_host normal diff --git a/share/tools/web_config/themes/coolbeans.theme b/share/tools/web_config/themes/coolbeans.theme index 804722f6e..4c7cd18f5 100644 --- a/share/tools/web_config/themes/coolbeans.theme +++ b/share/tools/web_config/themes/coolbeans.theme @@ -9,7 +9,7 @@ fish_color_comment '888' '--italics' fish_color_cwd 0A0 fish_color_cwd_root A00 fish_color_end 009900 -fish_color_error F22 +fish_color_error F22 --underline=curly fish_color_escape 0AA fish_color_history_current 0AA fish_color_host normal diff --git a/share/tools/web_config/themes/fish default.theme b/share/tools/web_config/themes/fish default.theme index 87f0759fc..b1e582e0e 100644 --- a/share/tools/web_config/themes/fish default.theme +++ b/share/tools/web_config/themes/fish default.theme @@ -11,7 +11,7 @@ fish_color_comment red fish_color_cwd green fish_color_cwd_root red fish_color_end green -fish_color_error brred +fish_color_error brred --underline=curly fish_color_escape brcyan fish_color_history_current --bold fish_color_host normal diff --git a/tests/checks/fish_config.fish b/tests/checks/fish_config.fish index 8e34abbbb..7c3daa0fa 100644 --- a/tests/checks/fish_config.fish +++ b/tests/checks/fish_config.fish @@ -1,7 +1,10 @@ #RUN: %fish %s mkdir $__fish_config_dir/themes -echo >$__fish_config_dir/themes/foo.theme 'fish_color_normal cyan' +echo >$__fish_config_dir/themes/foo.theme ' +fish_color_normal cyan +fish_color_error brred --underline=curly +' set -g fish_pager_color_secondary_background custom-value fish_config theme choose foo @@ -12,6 +15,14 @@ set -S fish_color_normal set -S fish_pager_color_secondary_background # CHECK: $fish_pager_color_secondary_background: set in global scope, unexported, with 0 elements +# Not a default theme, so we allow --underline=curly even if we don't run inside a terminal that +# advertises support via XTGETTCAP. +set -S fish_color_error +# CHECK: $fish_color_error: set in global scope, unexported, with 2 elements +# CHECK: $fish_color_error[1]: |brred| +# CHECK: $fish_color_error[2]: |--underline=curly| + + function change-theme echo >$__fish_config_dir/themes/fake-default.theme 'fish_color_command' $argv end