Patch 8.0.0661
Problem: Recognizing urxvt mouse codes does not work well.
Solution: Recognize "Esc[*M" and "Esc[*m". (Maurice Bos, closes #1486)
Files: src/keymap.h, src/misc2.c, src/os_unix.c, src/term.c
*** ../vim-8.0.0660/src/keymap.h 2017-01-22 15:05:08.107998905 +0100
--- src/keymap.h 2017-06-22 22:22:31.611662643 +0200
***************
*** 112,117 ****
--- 112,118 ----
/* Used for the sgr mouse. */
#define KS_SGR_MOUSE 237
+ #define KS_SGR_MOUSE_RELEASE 236 /* Release */
/*
* Filler used after KS_SPECIAL and others
***************
*** 416,421 ****
--- 417,423 ----
#define K_PTERM_MOUSE TERMCAP2KEY(KS_PTERM_MOUSE, KE_FILLER)
#define K_URXVT_MOUSE TERMCAP2KEY(KS_URXVT_MOUSE, KE_FILLER)
#define K_SGR_MOUSE TERMCAP2KEY(KS_SGR_MOUSE, KE_FILLER)
+ #define K_SGR_MOUSERELEASE TERMCAP2KEY(KS_SGR_MOUSE_RELEASE, KE_FILLER)
#define K_SELECT TERMCAP2KEY(KS_SELECT, KE_FILLER)
#define K_TEAROFF TERMCAP2KEY(KS_TEAROFF, KE_FILLER)
*** ../vim-8.0.0660/src/misc2.c 2017-04-10 22:22:38.545160122 +0200
--- src/misc2.c 2017-06-22 22:22:01.203906809 +0200
***************
*** 2438,2443 ****
--- 2438,2444 ----
#endif
#ifdef FEAT_MOUSE_SGR
{K_SGR_MOUSE, (char_u *)"SgrMouse"},
+ {K_SGR_MOUSERELEASE, (char_u *)"SgrMouseRelelase"},
#endif
{K_LEFTMOUSE, (char_u *)"LeftMouse"},
{K_LEFTMOUSE_NM, (char_u *)"LeftMouseNM"},
*** ../vim-8.0.0660/src/os_unix.c 2017-03-30 21:18:40.814968467 +0200
--- src/os_unix.c 2017-06-22 22:20:44.820520193 +0200
***************
*** 3771,3777 ****
del_mouse_termcode(KS_PTERM_MOUSE);
# endif
# ifdef FEAT_MOUSE_URXVT
- /* same conflict as the dec mouse */
if (use_xterm_mouse() == 3
# ifdef FEAT_GUI
&& !gui.in_use
--- 3771,3776 ----
***************
*** 3779,3786 ****
)
{
set_mouse_termcode(KS_URXVT_MOUSE, (char_u *)(term_is_8bit(T_NAME)
! ? IF_EB("\233", CSI_STR)
! : IF_EB("\033[", ESC_STR "[")));
if (*p_mouse != NUL)
{
--- 3778,3785 ----
)
{
set_mouse_termcode(KS_URXVT_MOUSE, (char_u *)(term_is_8bit(T_NAME)
! ? IF_EB("\233*M", CSI_STR "*M")
! : IF_EB("\033[*M", ESC_STR "[*M")));
if (*p_mouse != NUL)
{
***************
*** 3792,3798 ****
del_mouse_termcode(KS_URXVT_MOUSE);
# endif
# ifdef FEAT_MOUSE_SGR
- /* There is no conflict with xterm mouse */
if (use_xterm_mouse() == 4
# ifdef FEAT_GUI
&& !gui.in_use
--- 3791,3796 ----
***************
*** 3800,3807 ****
)
{
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)
{
--- 3798,3809 ----
)
{
set_mouse_termcode(KS_SGR_MOUSE, (char_u *)(term_is_8bit(T_NAME)
! ? IF_EB("\233<*M", CSI_STR "<*M")
! : IF_EB("\033[<*M", ESC_STR "[<*M")));
!
! set_mouse_termcode(KS_SGR_MOUSE_RELEASE, (char_u *)(term_is_8bit(T_NAME)
! ? IF_EB("\233<*m", CSI_STR "<*m")
! : IF_EB("\033[<*m", ESC_STR "[<*m")));
if (*p_mouse != NUL)
{
***************
*** 3810,3816 ****
--- 3812,3821 ----
}
}
else
+ {
del_mouse_termcode(KS_SGR_MOUSE);
+ del_mouse_termcode(KS_SGR_MOUSE_RELEASE);
+ }
# endif
}
#endif
*** ../vim-8.0.0660/src/term.c 2017-06-04 15:45:44.984507924 +0200
--- src/term.c 2017-06-22 22:37:37.120399410 +0200
***************
*** 3786,3794 ****
}
/*
! * Check termcode "code[len]" for ending in ;*X, <Esc>O*X or <M-O>*X.
* The "X" can be any character.
! * Return 0 if not found, 2 for ;*X and 1 for O*X and <M-O>*X.
*/
static int
termcode_star(char_u *code, int len)
--- 3786,3794 ----
}
/*
! * Check termcode "code[len]" for ending in ;*X or *X.
* The "X" can be any character.
! * Return 0 if not found, 2 for ;*X and 1 for *X.
*/
static int
termcode_star(char_u *code, int len)
***************
*** 3798,3804 ****
{
if (len >= 5 && code[len - 3] == ';')
return 2;
! if ((len >= 4 && code[len - 3] == 'O') || code[len - 3] == 'O' + 128)
return 1;
}
return 0;
--- 3798,3804 ----
{
if (len >= 5 && code[len - 3] == ';')
return 2;
! else
return 1;
}
return 0;
***************
*** 3940,3945 ****
--- 3940,3946 ----
int offset;
char_u key_name[2];
int modifiers;
+ char_u *modifiers_start;
int key;
int new_slen;
int extra;
***************
*** 4065,4070 ****
--- 4066,4072 ----
* But only when the 'K' flag is in 'cpoptions'.
*/
slen = termcodes[idx].len;
+ modifiers_start = NULL;
if (cpo_koffset && offset && len < slen)
continue;
if (STRNCMP(termcodes[idx].code, tp,
***************
*** 4125,4131 ****
{
/* Skip over the digits, the final char must
* follow. */
! for (j = slen - 2; j < len && isdigit(tp[j]); ++j)
;
++j;
if (len < j) /* got a partial sequence */
--- 4127,4133 ----
{
/* Skip over the digits, the final char must
* follow. */
! for (j = slen - 2; j < len && (isdigit(tp[j]) ||
tp[j] == ';'); ++j)
;
++j;
if (len < j) /* got a partial sequence */
***************
*** 4133,4140 ****
if (tp[j - 1] != termcodes[idx].code[slen - 1])
continue; /* no match */
/* Match! Convert modifier bits. */
! n = atoi((char *)tp + slen - 2) - 1;
if (n & 1)
modifiers |= MOD_MASK_SHIFT;
if (n & 2)
--- 4135,4144 ----
if (tp[j - 1] != termcodes[idx].code[slen - 1])
continue; /* no match */
+ modifiers_start = tp + slen - 2;
+
/* Match! Convert modifier bits. */
! n = atoi((char *)modifiers_start) - 1;
if (n & 1)
modifiers |= MOD_MASK_SHIFT;
if (n & 2)
***************
*** 4156,4162 ****
#ifdef FEAT_TERMRESPONSE
if (key_name[0] == NUL
! /* Mouse codes of DEC, pterm, and URXVT start with <ESC>[. When
* detecting the start of these mouse codes they might as well be
* another key code or terminal response. */
# ifdef FEAT_MOUSE_DEC
--- 4160,4166 ----
#ifdef FEAT_TERMRESPONSE
if (key_name[0] == NUL
! /* Mouse codes of DEC and pterm start with <ESC>[. When
* detecting the start of these mouse codes they might as well be
* another key code or terminal response. */
# ifdef FEAT_MOUSE_DEC
***************
*** 4165,4173 ****
# ifdef FEAT_MOUSE_PTERM
|| key_name[0] == KS_PTERM_MOUSE
# endif
- # ifdef FEAT_MOUSE_URXVT
- || key_name[0] == KS_URXVT_MOUSE
- # endif
)
{
/* Check for some responses from the terminal starting with
--- 4169,4174 ----
***************
*** 4509,4514 ****
--- 4510,4516 ----
# endif
# ifdef FEAT_MOUSE_SGR
|| key_name[0] == KS_SGR_MOUSE
+ || key_name[0] == KS_SGR_MOUSE_RELEASE
# endif
)
{
***************
*** 4592,4598 ****
# if defined(FEAT_MOUSE_URXVT) || defined(FEAT_MOUSE_SGR)
if (key_name[0] == KS_URXVT_MOUSE
! || key_name[0] == KS_SGR_MOUSE)
{
for (;;)
{
--- 4594,4601 ----
# if defined(FEAT_MOUSE_URXVT) || defined(FEAT_MOUSE_SGR)
if (key_name[0] == KS_URXVT_MOUSE
! || key_name[0] == KS_SGR_MOUSE
! || key_name[0] == KS_SGR_MOUSE_RELEASE)
{
for (;;)
{
***************
*** 4619,4674 ****
* ^----- column
* ^-------- code
*/
! p = tp + slen;
mouse_code = getdigits(&p);
if (*p++ != ';')
return -1;
/* when mouse reporting is SGR, add 32 to mouse code */
! if (key_name[0] == KS_SGR_MOUSE)
mouse_code += 32;
mouse_col = getdigits(&p) - 1;
if (*p++ != ';')
return -1;
mouse_row = getdigits(&p) - 1;
- if (key_name[0] == KS_SGR_MOUSE && *p == 'm')
- mouse_code |= MOUSE_RELEASE;
- else if (*p != 'M')
- return -1;
- p++;
! slen += (int)(p - (tp + slen));
- /* skip this one if next one has same code (like xterm
- * case) */
- j = termcodes[idx].len;
- if (STRNCMP(tp, tp + slen, (size_t)j) == 0)
- {
- int slen2;
- int cmd_complete = 0;
-
- /* check if the command is complete by looking for the
- * 'M' */
- for (slen2 = slen; slen2 < len; slen2++)
- {
- if (tp[slen2] == 'M'
- || (key_name[0] == KS_SGR_MOUSE
- && tp[slen2] == 'm'))
- {
- cmd_complete = 1;
- break;
- }
- }
- p += j;
- if (cmd_complete && getdigits(&p) == mouse_code)
- {
- slen += j; /* skip the \033[ */
- continue;
- }
- }
break;
}
}
--- 4622,4653 ----
* ^----- column
* ^-------- code
*/
! p = modifiers_start;
! if (p == NULL)
! return -1;
mouse_code = getdigits(&p);
if (*p++ != ';')
return -1;
/* when mouse reporting is SGR, add 32 to mouse code */
! if (key_name[0] == KS_SGR_MOUSE
! || key_name[0] == KS_SGR_MOUSE_RELEASE)
mouse_code += 32;
+ if (key_name[0] == KS_SGR_MOUSE_RELEASE)
+ mouse_code |= MOUSE_RELEASE;
+
mouse_col = getdigits(&p) - 1;
if (*p++ != ';')
return -1;
mouse_row = getdigits(&p) - 1;
! /* The modifiers were the mouse coordinates, not the
! * modifier keys (alt/shift/ctrl/meta) state. */
! modifiers = 0;
break;
}
}
***************
*** 4680,4685 ****
--- 4659,4665 ----
#endif
#ifdef FEAT_MOUSE_SGR
|| key_name[0] == KS_SGR_MOUSE
+ || key_name[0] == KS_SGR_MOUSE_RELEASE
#endif
)
{
*** ../vim-8.0.0660/src/version.c 2017-06-22 22:04:57.488133723 +0200
--- src/version.c 2017-06-22 22:21:16.668264438 +0200
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 661,
/**/
--
hundred-and-one symptoms of being an internet addict:
65. The last time you looked at the clock it was 11:30pm, and in what
seems like only a few seconds later, your sister runs past you to
catch her 7am school bus.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.