vi_cursor: For TERM = xterm require another condition

We cannot just use TERM = xterm and defined Ss sequence, as some old
vte-based terminals are still in the wild that don't support the
sequence and don't have $VTE_VERSION set.

I have tested this on

- konsole - supported and works ($KONSOLE_PROFILE_NAME)
- new xterm - supported and works ($XTERM_VERSION)
- lxterminal-gtk3 - supported and works ($VTE_VERSION)
- new gnome-terminal - supported and works ($VTE_VERSION)
- lxterminal-gtk2 - not supported and deactivated (no $VTE_VERSION)
- tmux in konsole - works
- tmux in lxterminal-gtk2 - deactivated

and for all supported ones with the respective variable erased, to see
that it is deactivated.

Fixes #3499.
This commit is contained in:
Fabian Homborg 2016-11-18 19:17:23 +01:00
parent 8423345e09
commit acc2353328

View file

@ -24,6 +24,7 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
and begin set -q KONSOLE_PROFILE_NAME
or set -q ITERM_PROFILE
or test "$VTE_VERSION" -ge 4000
or test (string replace -r "XTerm\((\d+)\)" '$1' -- $XTERM_VERSION) -ge 280
end
# .. unless an unsupporting terminal has been started in tmux inside a supporting one
and begin string match -q "screen*" -- $TERM
@ -39,6 +40,21 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes'
and test "$VTE_VERSION" -lt 4000
end
or set -q INSIDE_EMACS
or begin
# TERM = xterm is special because plenty of things claim to be it, but aren't fully compatible
# This includes old vte-terms (without $VTE_VERSION), old xterms (without $XTERM_VERSION or < 280)
# and maybe other stuff.
# This needs to be kept _at least_ as long as Ubuntu 14.04 is still a thing
# because that ships a gnome-terminal without support and without $VTE_VERSION.
string match -q 'xterm*' -- $TERM
and not begin set -q KONSOLE_PROFILE_NAME
or set -q ITERM_PROFILE
or test "$VTE_VERSION" -ge 4000
# If $XTERM_VERSION is undefined, this will return 1 and print an error. Silence it.
or test (string replace -r "XTerm\((\d+)\)" '$1' -- $XTERM_VERSION) -ge 280 ^/dev/null
end
end
return
end