Karsten Hopp 64226d
To: vim_dev@googlegroups.com
Karsten Hopp 64226d
Subject: Patch 7.3.946
Karsten Hopp 64226d
Fcc: outbox
Karsten Hopp 64226d
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 64226d
Mime-Version: 1.0
Karsten Hopp 64226d
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 64226d
Content-Transfer-Encoding: 8bit
Karsten Hopp 64226d
------------
Karsten Hopp 64226d
Karsten Hopp 64226d
Patch 7.3.946
Karsten Hopp 64226d
Problem:    Sometimes get stuck in waiting for cursor position report,
Karsten Hopp 64226d
	    resulting in keys starting with <Esc>[ not working.
Karsten Hopp 64226d
Solution:   Only wait for more characters after <Esc>[ if followed by '?', '>'
Karsten Hopp 64226d
	    or a digit.
Karsten Hopp 64226d
Files:	    src/term.c
Karsten Hopp 64226d
Karsten Hopp 64226d
Karsten Hopp 64226d
*** ../vim-7.3.945/src/term.c	2013-05-13 20:26:47.000000000 +0200
Karsten Hopp 64226d
--- src/term.c	2013-05-15 14:12:43.000000000 +0200
Karsten Hopp 64226d
***************
Karsten Hopp 64226d
*** 4126,4134 ****
Karsten Hopp 64226d
  	     *   The final byte is 'R'. now it is only used for checking for
Karsten Hopp 64226d
  	     *   ambiguous-width character state.
Karsten Hopp 64226d
  	     */
Karsten Hopp 64226d
  	    if ((*T_CRV != NUL || *T_U7 != NUL)
Karsten Hopp 64226d
  			&& ((tp[0] == ESC && tp[1] == '[' && len >= 3)
Karsten Hopp 64226d
! 			    || (tp[0] == CSI && len >= 2)))
Karsten Hopp 64226d
  	    {
Karsten Hopp 64226d
  		j = 0;
Karsten Hopp 64226d
  		extra = 0;
Karsten Hopp 64226d
--- 4126,4136 ----
Karsten Hopp 64226d
  	     *   The final byte is 'R'. now it is only used for checking for
Karsten Hopp 64226d
  	     *   ambiguous-width character state.
Karsten Hopp 64226d
  	     */
Karsten Hopp 64226d
+ 	    p = tp[0] == CSI ? tp + 1 : tp + 2;
Karsten Hopp 64226d
  	    if ((*T_CRV != NUL || *T_U7 != NUL)
Karsten Hopp 64226d
  			&& ((tp[0] == ESC && tp[1] == '[' && len >= 3)
Karsten Hopp 64226d
! 			    || (tp[0] == CSI && len >= 2))
Karsten Hopp 64226d
! 			&& (VIM_ISDIGIT(*p) || *p == '>' || *p == '?'))
Karsten Hopp 64226d
  	    {
Karsten Hopp 64226d
  		j = 0;
Karsten Hopp 64226d
  		extra = 0;
Karsten Hopp 64226d
***************
Karsten Hopp 64226d
*** 4136,4142 ****
Karsten Hopp 64226d
  				&& !(tp[i] >= '{' && tp[i] <= '~')
Karsten Hopp 64226d
  				&& !ASCII_ISALPHA(tp[i]); ++i)
Karsten Hopp 64226d
  		    if (tp[i] == ';' && ++j == 1)
Karsten Hopp 64226d
! 			extra = atoi((char *)tp + i + 1);
Karsten Hopp 64226d
  		if (i == len)
Karsten Hopp 64226d
  		    return -1;		/* not enough characters */
Karsten Hopp 64226d
  
Karsten Hopp 64226d
--- 4138,4144 ----
Karsten Hopp 64226d
  				&& !(tp[i] >= '{' && tp[i] <= '~')
Karsten Hopp 64226d
  				&& !ASCII_ISALPHA(tp[i]); ++i)
Karsten Hopp 64226d
  		    if (tp[i] == ';' && ++j == 1)
Karsten Hopp 64226d
! 			extra = i + 1;
Karsten Hopp 64226d
  		if (i == len)
Karsten Hopp 64226d
  		    return -1;		/* not enough characters */
Karsten Hopp 64226d
  
Karsten Hopp 64226d
***************
Karsten Hopp 64226d
*** 4150,4155 ****
Karsten Hopp 64226d
--- 4152,4159 ----
Karsten Hopp 64226d
  # ifdef FEAT_AUTOCMD
Karsten Hopp 64226d
  		    did_cursorhold = TRUE;
Karsten Hopp 64226d
  # endif
Karsten Hopp 64226d
+ 		    if (extra > 0)
Karsten Hopp 64226d
+ 			extra = atoi((char *)tp + extra);
Karsten Hopp 64226d
  		    if (extra == 2)
Karsten Hopp 64226d
  			aw = "single";
Karsten Hopp 64226d
  		    else if (extra == 3)
Karsten Hopp 64226d
***************
Karsten Hopp 64226d
*** 4178,4183 ****
Karsten Hopp 64226d
--- 4182,4189 ----
Karsten Hopp 64226d
  		    /* rxvt sends its version number: "20703" is 2.7.3.
Karsten Hopp 64226d
  		     * Ignore it for when the user has set 'term' to xterm,
Karsten Hopp 64226d
  		     * even though it's an rxvt. */
Karsten Hopp 64226d
+ 		    if (extra > 0)
Karsten Hopp 64226d
+ 			extra = atoi((char *)tp + extra);
Karsten Hopp 64226d
  		    if (extra > 20000)
Karsten Hopp 64226d
  			extra = 0;
Karsten Hopp 64226d
  
Karsten Hopp 64226d
*** ../vim-7.3.945/src/version.c	2013-05-15 13:38:41.000000000 +0200
Karsten Hopp 64226d
--- src/version.c	2013-05-15 14:17:51.000000000 +0200
Karsten Hopp 64226d
***************
Karsten Hopp 64226d
*** 730,731 ****
Karsten Hopp 64226d
--- 730,733 ----
Karsten Hopp 64226d
  {   /* Add new patch number below this line */
Karsten Hopp 64226d
+ /**/
Karsten Hopp 64226d
+     946,
Karsten Hopp 64226d
  /**/
Karsten Hopp 64226d
Karsten Hopp 64226d
-- 
Karsten Hopp 64226d
No letters of the alphabet were harmed in the creation of this message.
Karsten Hopp 64226d
Karsten Hopp 64226d
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 64226d
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 64226d
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 64226d
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///