From 7ea2dc448819b4a1cb7c846554754d8785a421e0 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 27 Oct 2016 10:16:57 +0200 Subject: [PATCH] Disable vi-cursor on xterm < 282 Fixes #3499. @zanchey: This is for integration-2.4.0. --- share/functions/fish_vi_cursor.fish | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/share/functions/fish_vi_cursor.fish b/share/functions/fish_vi_cursor.fish index be04eb430..47fa7467b 100644 --- a/share/functions/fish_vi_cursor.fish +++ b/share/functions/fish_vi_cursor.fish @@ -6,6 +6,17 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes' and not set -q TMUX return end + + # XTerm supports this sequence since version 282 + if test -n "$XTERM_VERSION" + # This will fail if $XTERM_VERSION is not in the "XTerm($version)" format. + # In that case, we cannot determine the terminal and should stop + # so "[1 q" does not show up on the user's screen + if not test (string replace -r 'XTerm\((\d*)\)' '$1' -- $XTERM_VERSION) -ge 282 + return + end + end + set -l terminal $argv[1] set -q terminal[1] or set terminal auto