diff options
author | Bram Moolenaar <Bram@vim.org> | 2012-08-15 16:21:32 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2012-08-15 16:21:32 +0200 |
commit | 2b9578f0f8cdba144e996273bca586b384e33d90 (patch) | |
tree | 02ae5bd4f971f8f08c62248baeae4d5f62939de5 /src/os_unix.c | |
parent | 2430586629dfccd637a23c45793fc182d2cb2b87 (diff) | |
download | vim-git-2b9578f0f8cdba144e996273bca586b384e33d90.tar.gz |
updated for version 7.3.632v7.3.632
Problem: Cannot select beyond 222 columns with the mouse in xterm.
Solution: Add support for SGR mouse tracking. (Hayaki Saito)
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 860fbcc40..98ff1ea66 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -2159,10 +2159,13 @@ use_xterm_like_mouse(name) * Return 1 for "xterm". * Return 2 for "xterm2". * Return 3 for "urxvt". + * Return 4 for "sgr". */ int use_xterm_mouse() { + if (ttym_flags == TTYM_SGR) + return 4; if (ttym_flags == TTYM_URXVT) return 3; if (ttym_flags == TTYM_XTERM2) @@ -3339,7 +3342,8 @@ mch_setmouse(on) xterm_mouse_vers = use_xterm_mouse(); # ifdef FEAT_MOUSE_URXVT - if (ttym_flags == TTYM_URXVT) { + if (ttym_flags == TTYM_URXVT) + { out_str_nf((char_u *) (on ? IF_EB("\033[?1015h", ESC_STR "[?1015h") @@ -3348,6 +3352,17 @@ mch_setmouse(on) } # endif +# ifdef FEAT_MOUSE_SGR + if (ttym_flags == TTYM_SGR) + { + out_str_nf((char_u *) + (on + ? IF_EB("\033[?1006h", ESC_STR "[?1006h") + : IF_EB("\033[?1006l", ESC_STR "[?1006l"))); + ison = on; + } +# endif + if (xterm_mouse_vers > 0) { if (on) /* enable mouse events, use mouse tracking if available */ @@ -3577,6 +3592,27 @@ check_mouse_termcode() else del_mouse_termcode(KS_URXVT_MOUSE); # endif +# ifdef FEAT_MOUSE_SGR + /* same as the dec mouse */ + if (use_xterm_mouse() == 4 +# ifdef FEAT_GUI + && !gui.in_use +# endif + ) + { + set_mouse_termcode(KS_SGR_MOUSE, (char_u *)(term_is_8bit(T_NAME) + ? IF_EB("\233<", CSI_STR "<") + : IF_EB("\033[<", ESC_STR "[<"))); + + if (*p_mouse != NUL) + { + mch_setmouse(FALSE); + setmouse(); + } + } + else + del_mouse_termcode(KS_SGR_MOUSE); +# endif } #endif |