Karsten Hopp 159f80
To: vim-dev@vim.org
Karsten Hopp 159f80
Subject: Patch 7.1.266
Karsten Hopp 159f80
Fcc: outbox
Karsten Hopp 159f80
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 159f80
Mime-Version: 1.0
Karsten Hopp 159f80
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 159f80
Content-Transfer-Encoding: 8bit
Karsten Hopp 159f80
------------
Karsten Hopp 159f80
Karsten Hopp 159f80
Patch 7.1.266
Karsten Hopp 159f80
Problem:    When the version string returned by the terminal contains
Karsten Hopp 159f80
	    unexpected characters, it is used as typed input. (James Vega)
Karsten Hopp 159f80
Solution:   Assume the escape sequence ends in a letter.
Karsten Hopp 159f80
Files:	    src/term.c
Karsten Hopp 159f80
Karsten Hopp 159f80
Karsten Hopp 159f80
*** ../vim-7.1.265/src/term.c	Sat Sep 15 14:06:41 2007
Karsten Hopp 159f80
--- src/term.c	Mon Feb 25 20:21:53 2008
Karsten Hopp 159f80
***************
Karsten Hopp 159f80
*** 4050,4064 ****
Karsten Hopp 159f80
  	{
Karsten Hopp 159f80
  	    /* Check for xterm version string: "<Esc>[>{x};{vers};{y}c".  Also
Karsten Hopp 159f80
  	     * eat other possible responses to t_RV, rxvt returns
Karsten Hopp 159f80
! 	     * "<Esc>[?1;2c".  Also accept CSI instead of <Esc>[. */
Karsten Hopp 159f80
  	    if (*T_CRV != NUL && ((tp[0] == ESC && tp[1] == '[' && len >= 3)
Karsten Hopp 159f80
  					       || (tp[0] == CSI && len >= 2)))
Karsten Hopp 159f80
  	    {
Karsten Hopp 159f80
  		j = 0;
Karsten Hopp 159f80
  		extra = 0;
Karsten Hopp 159f80
! 		for (i = 2 + (tp[0] != CSI);
Karsten Hopp 159f80
! 			i < len && (VIM_ISDIGIT(tp[i])
Karsten Hopp 159f80
! 			    || tp[i] == ';' || tp[i] == '.'); ++i)
Karsten Hopp 159f80
  		    if (tp[i] == ';' && ++j == 1)
Karsten Hopp 159f80
  			extra = atoi((char *)tp + i + 1);
Karsten Hopp 159f80
  		if (i == len)
Karsten Hopp 159f80
--- 4050,4066 ----
Karsten Hopp 159f80
  	{
Karsten Hopp 159f80
  	    /* Check for xterm version string: "<Esc>[>{x};{vers};{y}c".  Also
Karsten Hopp 159f80
  	     * eat other possible responses to t_RV, rxvt returns
Karsten Hopp 159f80
! 	     * "<Esc>[?1;2c".  Also accept CSI instead of <Esc>[.
Karsten Hopp 159f80
! 	     * mrxvt has been reported to have "+" in the version. Assume
Karsten Hopp 159f80
! 	     * the escape sequence ends with a letter or one of "{|}~". */
Karsten Hopp 159f80
  	    if (*T_CRV != NUL && ((tp[0] == ESC && tp[1] == '[' && len >= 3)
Karsten Hopp 159f80
  					       || (tp[0] == CSI && len >= 2)))
Karsten Hopp 159f80
  	    {
Karsten Hopp 159f80
  		j = 0;
Karsten Hopp 159f80
  		extra = 0;
Karsten Hopp 159f80
! 		for (i = 2 + (tp[0] != CSI); i < len
Karsten Hopp 159f80
! 				&& !(tp[i] >= '{' && tp[i] <= '~')
Karsten Hopp 159f80
! 				&& !ASCII_ISALPHA(tp[i]); ++i)
Karsten Hopp 159f80
  		    if (tp[i] == ';' && ++j == 1)
Karsten Hopp 159f80
  			extra = atoi((char *)tp + i + 1);
Karsten Hopp 159f80
  		if (i == len)
Karsten Hopp 159f80
*** ../vim-7.1.265/src/version.c	Tue Feb 26 21:29:06 2008
Karsten Hopp 159f80
--- src/version.c	Wed Feb 27 16:10:59 2008
Karsten Hopp 159f80
***************
Karsten Hopp 159f80
*** 668,669 ****
Karsten Hopp 159f80
--- 668,671 ----
Karsten Hopp 159f80
  {   /* Add new patch number below this line */
Karsten Hopp 159f80
+ /**/
Karsten Hopp 159f80
+     266,
Karsten Hopp 159f80
  /**/
Karsten Hopp 159f80
Karsten Hopp 159f80
-- 
Karsten Hopp 159f80
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 159f80
54. You start tilting your head sideways to smile. :-)
Karsten Hopp 159f80
Karsten Hopp 159f80
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 159f80
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 159f80
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 159f80
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///