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