Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.1.266
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.1.266
Problem:    When the version string returned by the terminal contains
	    unexpected characters, it is used as typed input. (James Vega)
Solution:   Assume the escape sequence ends in a letter.
Files:	    src/term.c


*** ../vim-7.1.265/src/term.c	Sat Sep 15 14:06:41 2007
--- src/term.c	Mon Feb 25 20:21:53 2008
***************
*** 4050,4064 ****
  	{
  	    /* Check for xterm version string: "<Esc>[>{x};{vers};{y}c".  Also
  	     * eat other possible responses to t_RV, rxvt returns
! 	     * "<Esc>[?1;2c".  Also accept CSI instead of <Esc>[. */
  	    if (*T_CRV != NUL && ((tp[0] == ESC && tp[1] == '[' && len >= 3)
  					       || (tp[0] == CSI && len >= 2)))
  	    {
  		j = 0;
  		extra = 0;
! 		for (i = 2 + (tp[0] != CSI);
! 			i < len && (VIM_ISDIGIT(tp[i])
! 			    || tp[i] == ';' || tp[i] == '.'); ++i)
  		    if (tp[i] == ';' && ++j == 1)
  			extra = atoi((char *)tp + i + 1);
  		if (i == len)
--- 4050,4066 ----
  	{
  	    /* Check for xterm version string: "<Esc>[>{x};{vers};{y}c".  Also
  	     * eat other possible responses to t_RV, rxvt returns
! 	     * "<Esc>[?1;2c".  Also accept CSI instead of <Esc>[.
! 	     * mrxvt has been reported to have "+" in the version. Assume
! 	     * the escape sequence ends with a letter or one of "{|}~". */
  	    if (*T_CRV != NUL && ((tp[0] == ESC && tp[1] == '[' && len >= 3)
  					       || (tp[0] == CSI && len >= 2)))
  	    {
  		j = 0;
  		extra = 0;
! 		for (i = 2 + (tp[0] != CSI); i < len
! 				&& !(tp[i] >= '{' && tp[i] <= '~')
! 				&& !ASCII_ISALPHA(tp[i]); ++i)
  		    if (tp[i] == ';' && ++j == 1)
  			extra = atoi((char *)tp + i + 1);
  		if (i == len)
*** ../vim-7.1.265/src/version.c	Tue Feb 26 21:29:06 2008
--- src/version.c	Wed Feb 27 16:10:59 2008
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     266,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
54. You start tilting your head sideways to smile. :-)

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///