Activate fish_vi_cursor for tmux

Discussions with the tmux maintainer show that:

1. We no longer need the passthrough sequence at all (and it's
deactivated by default)
2. Tmux can check if the outer terminal supports cursor shaping

Fixes #8981

(cherry picked from commit b4a3b9982c)
This commit is contained in:
Fabian Boehm 2022-07-13 21:45:32 +08:00 committed by David Adam
parent 687a16b260
commit 6e9590b220
2 changed files with 10 additions and 15 deletions

View File

@ -1,12 +1,17 @@
fish 3.5.1 (released ???) fish 3.5.1 (released ???)
==================================== ====================================
This release of fish fixes a number of problems identified in fish 3.5.0. This release of fish introduces the following small enhancements:
- Cursor shaping for Vi mode is enabled by default in tmux, and will be used if the outer terminal is capable (:issue:`8981`).
This release also fixes a number of problems identified in fish 3.5.0.
- Completing ``git blame`` or ``git -C`` works correctly (:issue:`9053`). - Completing ``git blame`` or ``git -C`` works correctly (:issue:`9053`).
- On terminals that emit a ``CSI u`` sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`). - On terminals that emit a ``CSI u`` sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`).
- ``status fish-path`` on Linux-based platforms could print the path with a " (deleted)" suffix (such as ``/usr/bin/fish (deleted)``), which is now removed (:issue:`9019`). - ``status fish-path`` on Linux-based platforms could print the path with a " (deleted)" suffix (such as ``/usr/bin/fish (deleted)``), which is now removed (:issue:`9019`).
-------------- --------------
fish 3.5.0 (released June 16, 2022) fish 3.5.0 (released June 16, 2022)

View File

@ -37,9 +37,6 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
# - It is set for xterm, and everyone and their dog claims to be xterm # - It is set for xterm, and everyone and their dog claims to be xterm
# #
# So we just don't care about $TERM, unless it is one of the few terminals that actually have their own entry. # So we just don't care about $TERM, unless it is one of the few terminals that actually have their own entry.
#
# Note: Previous versions also checked $TMUX, and made sure that then $TERM was screen* or tmux*.
# We don't care, since we *cannot* handle term-in-a-terms 100% correctly.
if not set -q KONSOLE_PROFILE_NAME if not set -q KONSOLE_PROFILE_NAME
and not test -n "$KONSOLE_VERSION" -a "$KONSOLE_VERSION" -ge 200400 # konsole, but new. and not test -n "$KONSOLE_VERSION" -a "$KONSOLE_VERSION" -ge 200400 # konsole, but new.
and not set -q ITERM_PROFILE and not set -q ITERM_PROFILE
@ -52,6 +49,10 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
and not string match -q 'rxvt*' -- $TERM and not string match -q 'rxvt*' -- $TERM
and not string match -q 'alacritty*' -- $TERM and not string match -q 'alacritty*' -- $TERM
and not string match -q 'foot*' -- $TERM and not string match -q 'foot*' -- $TERM
and not begin
set -q TMUX
and string match -qr '^screen|^tmux' -- $TERM
end
return return
end end
end end
@ -78,13 +79,6 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
set function __fish_cursor_xterm set function __fish_cursor_xterm
end end
set -l tmux_prefix
set -l tmux_postfix
if set -q TMUX
set tmux_prefix echo -ne "'\ePtmux;\e'"
set tmux_postfix echo -ne "'\e\\\\'"
end
set -q fish_cursor_unknown set -q fish_cursor_unknown
or set -g fish_cursor_unknown block or set -g fish_cursor_unknown block
@ -94,9 +88,7 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
if not set -q \$varname if not set -q \$varname
set varname fish_cursor_unknown set varname fish_cursor_unknown
end end
$tmux_prefix
$function \$\$varname $function \$\$varname
$tmux_postfix
end end
" | source " | source
@ -106,9 +98,7 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
if not set -q \$varname if not set -q \$varname
set varname fish_cursor_unknown set varname fish_cursor_unknown
end end
$tmux_prefix
$function \$\$varname $function \$\$varname
$tmux_postfix
end end
" | source " | source
end end