073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.207
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.207
073263
Problem:    The cursor report sequence is sometimes not recognized and results
073263
	    in entering replace mode.
073263
Solution:   Also check for the cursor report when not asked for.
073263
Files:	    src/term.c
073263
073263
073263
*** ../vim-7.4.206/src/term.c	2013-09-29 16:27:42.000000000 +0200
073263
--- src/term.c	2014-03-19 13:30:23.589874866 +0100
073263
***************
073263
*** 3379,3385 ****
073263
  	 out_str(buf);
073263
  	 out_str(T_U7);
073263
  	 u7_status = U7_SENT;
073263
! 	 term_windgoto(0, 0);
073263
  	 out_str((char_u *)"  ");
073263
  	 term_windgoto(0, 0);
073263
  	 /* check for the characters now, otherwise they might be eaten by
073263
--- 3379,3386 ----
073263
  	 out_str(buf);
073263
  	 out_str(T_U7);
073263
  	 u7_status = U7_SENT;
073263
! 	 out_flush();
073263
! 	 term_windgoto(1, 0);
073263
  	 out_str((char_u *)"  ");
073263
  	 term_windgoto(0, 0);
073263
  	 /* check for the characters now, otherwise they might be eaten by
073263
***************
073263
*** 4185,4208 ****
073263
  			    || (tp[0] == CSI && len >= 2))
073263
  			&& (VIM_ISDIGIT(*p) || *p == '>' || *p == '?'))
073263
  	    {
073263
  		j = 0;
073263
  		extra = 0;
073263
  		for (i = 2 + (tp[0] != CSI); i < len
073263
  				&& !(tp[i] >= '{' && tp[i] <= '~')
073263
  				&& !ASCII_ISALPHA(tp[i]); ++i)
073263
  		    if (tp[i] == ';' && ++j == 1)
073263
  			extra = i + 1;
073263
  		if (i == len)
073263
  		{
073263
  		    LOG_TR("Not enough characters for CRV");
073263
  		    return -1;
073263
  		}
073263
- 
073263
  #ifdef FEAT_MBYTE
073263
! 		/* Eat it when it has 2 arguments and ends in 'R'. Ignore it
073263
! 		 * when u7_status is not "sent", <S-F3> sends something
073263
! 		 * similar. */
073263
! 		if (j == 1 && tp[i] == 'R' && u7_status == U7_SENT)
073263
  		{
073263
  		    char *aw = NULL;
073263
  
073263
--- 4186,4223 ----
073263
  			    || (tp[0] == CSI && len >= 2))
073263
  			&& (VIM_ISDIGIT(*p) || *p == '>' || *p == '?'))
073263
  	    {
073263
+ #ifdef FEAT_MBYTE
073263
+ 		int col;
073263
+ 		int row_char;
073263
+ #endif
073263
  		j = 0;
073263
  		extra = 0;
073263
  		for (i = 2 + (tp[0] != CSI); i < len
073263
  				&& !(tp[i] >= '{' && tp[i] <= '~')
073263
  				&& !ASCII_ISALPHA(tp[i]); ++i)
073263
  		    if (tp[i] == ';' && ++j == 1)
073263
+ 		    {
073263
  			extra = i + 1;
073263
+ #ifdef FEAT_MBYTE
073263
+ 			row_char = tp[i - 1];
073263
+ #endif
073263
+ 		    }
073263
  		if (i == len)
073263
  		{
073263
  		    LOG_TR("Not enough characters for CRV");
073263
  		    return -1;
073263
  		}
073263
  #ifdef FEAT_MBYTE
073263
! 		if (extra > 0)
073263
! 		    col = atoi((char *)tp + extra);
073263
! 		else
073263
! 		    col = 0;
073263
! 
073263
! 		/* Eat it when it has 2 arguments and ends in 'R'. Also when
073263
! 		 * u7_status is not "sent", it may be from a previous Vim that
073263
! 		 * just exited.  But not for <S-F3>, it sends something
073263
! 		 * similar, check for row and column to make sense. */
073263
! 		if (j == 1 && tp[i] == 'R' && row_char == '2' && col >= 2)
073263
  		{
073263
  		    char *aw = NULL;
073263
  
073263
***************
073263
*** 4211,4228 ****
073263
  # ifdef FEAT_AUTOCMD
073263
  		    did_cursorhold = TRUE;
073263
  # endif
073263
! 		    if (extra > 0)
073263
! 			extra = atoi((char *)tp + extra);
073263
! 		    if (extra == 2)
073263
  			aw = "single";
073263
! 		    else if (extra == 3)
073263
  			aw = "double";
073263
  		    if (aw != NULL && STRCMP(aw, p_ambw) != 0)
073263
  		    {
073263
  			/* Setting the option causes a screen redraw. Do that
073263
  			 * right away if possible, keeping any messages. */
073263
  			set_option_value((char_u *)"ambw", 0L, (char_u *)aw, 0);
073263
! #ifdef DEBUG_TERMRESPONSE
073263
  			{
073263
  			    char buf[100];
073263
  			    int  r = redraw_asap(CLEAR);
073263
--- 4226,4241 ----
073263
  # ifdef FEAT_AUTOCMD
073263
  		    did_cursorhold = TRUE;
073263
  # endif
073263
! 		    if (col == 2)
073263
  			aw = "single";
073263
! 		    else if (col == 3)
073263
  			aw = "double";
073263
  		    if (aw != NULL && STRCMP(aw, p_ambw) != 0)
073263
  		    {
073263
  			/* Setting the option causes a screen redraw. Do that
073263
  			 * right away if possible, keeping any messages. */
073263
  			set_option_value((char_u *)"ambw", 0L, (char_u *)aw, 0);
073263
! # ifdef DEBUG_TERMRESPONSE
073263
  			{
073263
  			    char buf[100];
073263
  			    int  r = redraw_asap(CLEAR);
073263
***************
073263
*** 4231,4239 ****
073263
  									   r);
073263
  			    log_tr(buf);
073263
  			}
073263
! #else
073263
  			redraw_asap(CLEAR);
073263
! #endif
073263
  		    }
073263
  		    key_name[0] = (int)KS_EXTRA;
073263
  		    key_name[1] = (int)KE_IGNORE;
073263
--- 4244,4252 ----
073263
  									   r);
073263
  			    log_tr(buf);
073263
  			}
073263
! # else
073263
  			redraw_asap(CLEAR);
073263
! # endif
073263
  		    }
073263
  		    key_name[0] = (int)KS_EXTRA;
073263
  		    key_name[1] = (int)KE_IGNORE;
073263
*** ../vim-7.4.206/src/version.c	2014-03-19 12:37:18.537826062 +0100
073263
--- src/version.c	2014-03-19 12:55:42.249842974 +0100
073263
***************
073263
*** 740,741 ****
073263
--- 740,743 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     207,
073263
  /**/
073263
073263
-- 
073263
How come wrong numbers are never busy?
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///