Karsten Hopp b3fcd8
To: vim_dev@googlegroups.com
Karsten Hopp b3fcd8
Subject: Patch 7.4.389
Karsten Hopp b3fcd8
Fcc: outbox
Karsten Hopp b3fcd8
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp b3fcd8
Mime-Version: 1.0
Karsten Hopp b3fcd8
Content-Type: text/plain; charset=UTF-8
Karsten Hopp b3fcd8
Content-Transfer-Encoding: 8bit
Karsten Hopp b3fcd8
------------
Karsten Hopp b3fcd8
Karsten Hopp b3fcd8
Patch 7.4.389
Karsten Hopp b3fcd8
Problem:    Still sometimes Vim enters Replace mode when starting up.
Karsten Hopp b3fcd8
Solution:   Use a different solution in detecting the termresponse and
Karsten Hopp b3fcd8
	    location response. (Hayaki Saito)
Karsten Hopp b3fcd8
Files:	    src/globals.h, src/os_unix.c, src/term.c, src/proto/term.pro
Karsten Hopp b3fcd8
Karsten Hopp b3fcd8
Karsten Hopp b3fcd8
*** ../vim-7.4.388/src/globals.h	2014-06-12 14:01:27.575769788 +0200
Karsten Hopp b3fcd8
--- src/globals.h	2014-07-30 17:02:57.711526671 +0200
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 1336,1344 ****
Karsten Hopp b3fcd8
  #if defined(UNIX) || defined(VMS)
Karsten Hopp b3fcd8
  EXTERN int	term_is_xterm INIT(= FALSE);	/* xterm-like 'term' */
Karsten Hopp b3fcd8
  #endif
Karsten Hopp b3fcd8
- #if defined(UNIX)
Karsten Hopp b3fcd8
- EXTERN int	xterm_conflict_mouse INIT(= FALSE);
Karsten Hopp b3fcd8
- #endif
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  #ifdef BACKSLASH_IN_FILENAME
Karsten Hopp b3fcd8
  EXTERN char	psepc INIT(= '\\');	/* normal path separator character */
Karsten Hopp b3fcd8
--- 1336,1341 ----
Karsten Hopp b3fcd8
*** ../vim-7.4.388/src/os_unix.c	2014-07-09 19:13:45.007701718 +0200
Karsten Hopp b3fcd8
--- src/os_unix.c	2014-07-30 17:06:02.375525344 +0200
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 3667,3674 ****
Karsten Hopp b3fcd8
      void
Karsten Hopp b3fcd8
  check_mouse_termcode()
Karsten Hopp b3fcd8
  {
Karsten Hopp b3fcd8
-     xterm_conflict_mouse = FALSE;
Karsten Hopp b3fcd8
- 
Karsten Hopp b3fcd8
  # ifdef FEAT_MOUSE_XTERM
Karsten Hopp b3fcd8
      if (use_xterm_mouse()
Karsten Hopp b3fcd8
  # ifdef FEAT_MOUSE_URXVT
Karsten Hopp b3fcd8
--- 3667,3672 ----
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 3713,3719 ****
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  # ifdef FEAT_MOUSE_JSB
Karsten Hopp b3fcd8
!     /* There is no conflict, but it was disabled for xterm before. */
Karsten Hopp b3fcd8
      if (!use_xterm_mouse()
Karsten Hopp b3fcd8
  #  ifdef FEAT_GUI
Karsten Hopp b3fcd8
  	    && !gui.in_use
Karsten Hopp b3fcd8
--- 3711,3717 ----
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  # ifdef FEAT_MOUSE_JSB
Karsten Hopp b3fcd8
!     /* Conflicts with xterm mouse: "\033[" and "\033[M" ??? */
Karsten Hopp b3fcd8
      if (!use_xterm_mouse()
Karsten Hopp b3fcd8
  #  ifdef FEAT_GUI
Karsten Hopp b3fcd8
  	    && !gui.in_use
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 3740,3784 ****
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  # ifdef FEAT_MOUSE_DEC
Karsten Hopp b3fcd8
!     /* Conflicts with xterm mouse: "\033[" and "\033[M".
Karsten Hopp b3fcd8
!      * Also conflicts with the xterm termresponse, skip this if it was
Karsten Hopp b3fcd8
!      * requested already. */
Karsten Hopp b3fcd8
      if (!use_xterm_mouse()
Karsten Hopp b3fcd8
- #  ifdef FEAT_TERMRESPONSE
Karsten Hopp b3fcd8
- 	    && !did_request_esc_sequence()
Karsten Hopp b3fcd8
- #  endif
Karsten Hopp b3fcd8
  #  ifdef FEAT_GUI
Karsten Hopp b3fcd8
  	    && !gui.in_use
Karsten Hopp b3fcd8
  #  endif
Karsten Hopp b3fcd8
  	    )
Karsten Hopp b3fcd8
-     {
Karsten Hopp b3fcd8
  	set_mouse_termcode(KS_DEC_MOUSE, (char_u *)(term_is_8bit(T_NAME)
Karsten Hopp b3fcd8
  		     ? IF_EB("\233", CSI_STR) : IF_EB("\033[", ESC_STR "[")));
Karsten Hopp b3fcd8
- 	xterm_conflict_mouse = TRUE;
Karsten Hopp b3fcd8
-     }
Karsten Hopp b3fcd8
      else
Karsten Hopp b3fcd8
  	del_mouse_termcode(KS_DEC_MOUSE);
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
  # ifdef FEAT_MOUSE_PTERM
Karsten Hopp b3fcd8
!     /* same as the dec mouse */
Karsten Hopp b3fcd8
      if (!use_xterm_mouse()
Karsten Hopp b3fcd8
- #  ifdef FEAT_TERMRESPONSE
Karsten Hopp b3fcd8
- 	    && !did_request_esc_sequence()
Karsten Hopp b3fcd8
- #  endif
Karsten Hopp b3fcd8
  #  ifdef FEAT_GUI
Karsten Hopp b3fcd8
  	    && !gui.in_use
Karsten Hopp b3fcd8
  #  endif
Karsten Hopp b3fcd8
  	    )
Karsten Hopp b3fcd8
-     {
Karsten Hopp b3fcd8
  	set_mouse_termcode(KS_PTERM_MOUSE,
Karsten Hopp b3fcd8
  				      (char_u *) IF_EB("\033[", ESC_STR "["));
Karsten Hopp b3fcd8
- 	xterm_conflict_mouse = TRUE;
Karsten Hopp b3fcd8
-     }
Karsten Hopp b3fcd8
      else
Karsten Hopp b3fcd8
  	del_mouse_termcode(KS_PTERM_MOUSE);
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
  # ifdef FEAT_MOUSE_URXVT
Karsten Hopp b3fcd8
!     /* same as the dec mouse */
Karsten Hopp b3fcd8
      if (use_xterm_mouse() == 3
Karsten Hopp b3fcd8
  #  ifdef FEAT_GUI
Karsten Hopp b3fcd8
  	    && !gui.in_use
Karsten Hopp b3fcd8
--- 3738,3768 ----
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  # ifdef FEAT_MOUSE_DEC
Karsten Hopp b3fcd8
!     /* Conflicts with xterm mouse: "\033[" and "\033[M" */
Karsten Hopp b3fcd8
      if (!use_xterm_mouse()
Karsten Hopp b3fcd8
  #  ifdef FEAT_GUI
Karsten Hopp b3fcd8
  	    && !gui.in_use
Karsten Hopp b3fcd8
  #  endif
Karsten Hopp b3fcd8
  	    )
Karsten Hopp b3fcd8
  	set_mouse_termcode(KS_DEC_MOUSE, (char_u *)(term_is_8bit(T_NAME)
Karsten Hopp b3fcd8
  		     ? IF_EB("\233", CSI_STR) : IF_EB("\033[", ESC_STR "[")));
Karsten Hopp b3fcd8
      else
Karsten Hopp b3fcd8
  	del_mouse_termcode(KS_DEC_MOUSE);
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
  # ifdef FEAT_MOUSE_PTERM
Karsten Hopp b3fcd8
!     /* same conflict as the dec mouse */
Karsten Hopp b3fcd8
      if (!use_xterm_mouse()
Karsten Hopp b3fcd8
  #  ifdef FEAT_GUI
Karsten Hopp b3fcd8
  	    && !gui.in_use
Karsten Hopp b3fcd8
  #  endif
Karsten Hopp b3fcd8
  	    )
Karsten Hopp b3fcd8
  	set_mouse_termcode(KS_PTERM_MOUSE,
Karsten Hopp b3fcd8
  				      (char_u *) IF_EB("\033[", ESC_STR "["));
Karsten Hopp b3fcd8
      else
Karsten Hopp b3fcd8
  	del_mouse_termcode(KS_PTERM_MOUSE);
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
  # ifdef FEAT_MOUSE_URXVT
Karsten Hopp b3fcd8
!     /* same conflict as the dec mouse */
Karsten Hopp b3fcd8
      if (use_xterm_mouse() == 3
Karsten Hopp b3fcd8
  #  ifdef FEAT_GUI
Karsten Hopp b3fcd8
  	    && !gui.in_use
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 3794,3801 ****
Karsten Hopp b3fcd8
  	    mch_setmouse(FALSE);
Karsten Hopp b3fcd8
  	    setmouse();
Karsten Hopp b3fcd8
  	}
Karsten Hopp b3fcd8
- 	/* It's OK to request the xterm version for uxterm. */
Karsten Hopp b3fcd8
- 	resume_get_esc_sequence();
Karsten Hopp b3fcd8
      }
Karsten Hopp b3fcd8
      else
Karsten Hopp b3fcd8
  	del_mouse_termcode(KS_URXVT_MOUSE);
Karsten Hopp b3fcd8
--- 3778,3783 ----
Karsten Hopp b3fcd8
*** ../vim-7.4.388/src/term.c	2014-07-09 20:51:04.519583033 +0200
Karsten Hopp b3fcd8
--- src/term.c	2014-07-30 17:20:54.915518929 +0200
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 153,163 ****
Karsten Hopp b3fcd8
  static char_u *vim_tgetstr __ARGS((char *s, char_u **pp));
Karsten Hopp b3fcd8
  #endif /* HAVE_TGETENT */
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
- #if defined(FEAT_TERMRESPONSE)
Karsten Hopp b3fcd8
- static int xt_index_in = 0;
Karsten Hopp b3fcd8
- static int xt_index_out = 0;
Karsten Hopp b3fcd8
- #endif
Karsten Hopp b3fcd8
- 
Karsten Hopp b3fcd8
  static int  detected_8bit = FALSE;	/* detected 8-bit terminal */
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  static struct builtin_term builtin_termcaps[] =
Karsten Hopp b3fcd8
--- 153,158 ----
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 3312,3351 ****
Karsten Hopp b3fcd8
  }
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  #if defined(FEAT_TERMRESPONSE) || defined(PROTO)
Karsten Hopp b3fcd8
- # if defined(UNIX) || defined(PROTO)
Karsten Hopp b3fcd8
- /*
Karsten Hopp b3fcd8
-  * Return TRUE when the xterm version was requested or anything else that
Karsten Hopp b3fcd8
-  * would send an ESC sequence back to Vim.
Karsten Hopp b3fcd8
-  * If not sent yet, prevent it from being sent soon.
Karsten Hopp b3fcd8
-  * Used to check whether it is OK to enable checking for DEC mouse codes,
Karsten Hopp b3fcd8
-  * which conflict with may xterm ESC sequences.
Karsten Hopp b3fcd8
-  */
Karsten Hopp b3fcd8
-     int
Karsten Hopp b3fcd8
- did_request_esc_sequence()
Karsten Hopp b3fcd8
- {
Karsten Hopp b3fcd8
-     if (crv_status == CRV_GET)
Karsten Hopp b3fcd8
- 	crv_status = 0;
Karsten Hopp b3fcd8
-     if (u7_status == U7_GET)
Karsten Hopp b3fcd8
- 	u7_status = 0;
Karsten Hopp b3fcd8
-     return crv_status == CRV_SENT || u7_status == U7_SENT
Karsten Hopp b3fcd8
- 						|| xt_index_out > xt_index_in;
Karsten Hopp b3fcd8
- }
Karsten Hopp b3fcd8
- 
Karsten Hopp b3fcd8
- /*
Karsten Hopp b3fcd8
-  * If requesting the version was disabled in did_request_esc_sequence(),
Karsten Hopp b3fcd8
-  * enable it again.
Karsten Hopp b3fcd8
-  */
Karsten Hopp b3fcd8
-     void
Karsten Hopp b3fcd8
- resume_get_esc_sequence()
Karsten Hopp b3fcd8
- {
Karsten Hopp b3fcd8
-     if (crv_status == 0)
Karsten Hopp b3fcd8
- 	crv_status = CRV_GET;
Karsten Hopp b3fcd8
-     if (u7_status == 0)
Karsten Hopp b3fcd8
- 	u7_status = U7_GET;
Karsten Hopp b3fcd8
- }
Karsten Hopp b3fcd8
- # endif
Karsten Hopp b3fcd8
- 
Karsten Hopp b3fcd8
- 
Karsten Hopp b3fcd8
  /*
Karsten Hopp b3fcd8
   * Request version string (for xterm) when needed.
Karsten Hopp b3fcd8
   * Only do this after switching to raw mode, otherwise the result will be
Karsten Hopp b3fcd8
--- 3307,3312 ----
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 3358,3365 ****
Karsten Hopp b3fcd8
   * Insert mode.
Karsten Hopp b3fcd8
   * On Unix only do it when both output and input are a tty (avoid writing
Karsten Hopp b3fcd8
   * request to terminal while reading from a file).
Karsten Hopp b3fcd8
-  * Do not do this when a mouse is being detected that starts with the same ESC
Karsten Hopp b3fcd8
-  * sequence as the termresponse.
Karsten Hopp b3fcd8
   * The result is caught in check_termcode().
Karsten Hopp b3fcd8
   */
Karsten Hopp b3fcd8
      void
Karsten Hopp b3fcd8
--- 3319,3324 ----
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 3373,3379 ****
Karsten Hopp b3fcd8
  # ifdef UNIX
Karsten Hopp b3fcd8
  	    && isatty(1)
Karsten Hopp b3fcd8
  	    && isatty(read_cmd_fd)
Karsten Hopp b3fcd8
- 	    && !xterm_conflict_mouse
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
  	    && *T_CRV != NUL)
Karsten Hopp b3fcd8
      {
Karsten Hopp b3fcd8
--- 3332,3337 ----
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 3742,3749 ****
Karsten Hopp b3fcd8
  #if defined(WIN3264) && !defined(FEAT_GUI)
Karsten Hopp b3fcd8
      if (s[0] == K_NUL)
Karsten Hopp b3fcd8
      {
Karsten Hopp b3fcd8
!         STRMOVE(s + 1, s);
Karsten Hopp b3fcd8
!         s[1] = 3;
Karsten Hopp b3fcd8
      }
Karsten Hopp b3fcd8
  #endif
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
--- 3700,3707 ----
Karsten Hopp b3fcd8
  #if defined(WIN3264) && !defined(FEAT_GUI)
Karsten Hopp b3fcd8
      if (s[0] == K_NUL)
Karsten Hopp b3fcd8
      {
Karsten Hopp b3fcd8
! 	STRMOVE(s + 1, s);
Karsten Hopp b3fcd8
! 	s[1] = 3;
Karsten Hopp b3fcd8
      }
Karsten Hopp b3fcd8
  #endif
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 4212,4235 ****
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  #ifdef FEAT_TERMRESPONSE
Karsten Hopp b3fcd8
  	if (key_name[0] == NUL
Karsten Hopp b3fcd8
! 	    /* URXVT mouse uses <ESC>[#;#;#M, but we are matching <ESC>[ */
Karsten Hopp b3fcd8
  	    || key_name[0] == KS_URXVT_MOUSE
Karsten Hopp b3fcd8
- # ifdef FEAT_MBYTE
Karsten Hopp b3fcd8
- 	    || u7_status == U7_SENT
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
!             )
Karsten Hopp b3fcd8
  	{
Karsten Hopp b3fcd8
! 	    /* Check for some responses from terminal start with "<Esc>[" or
Karsten Hopp b3fcd8
! 	     * CSI.
Karsten Hopp b3fcd8
  	     *
Karsten Hopp b3fcd8
! 	     * - xterm version string: <Esc>[>{x};{vers};{y}c
Karsten Hopp b3fcd8
  	     *   Also eat other possible responses to t_RV, rxvt returns
Karsten Hopp b3fcd8
  	     *   "<Esc>[?1;2c". Also accept CSI instead of <Esc>[.
Karsten Hopp b3fcd8
  	     *   mrxvt has been reported to have "+" in the version. Assume
Karsten Hopp b3fcd8
  	     *   the escape sequence ends with a letter or one of "{|}~".
Karsten Hopp b3fcd8
  	     *
Karsten Hopp b3fcd8
! 	     * - cursor position report: <Esc>[{row};{col}R
Karsten Hopp b3fcd8
! 	     *   The final byte is 'R'. now it is only used for checking for
Karsten Hopp b3fcd8
  	     *   ambiguous-width character state.
Karsten Hopp b3fcd8
  	     */
Karsten Hopp b3fcd8
  	    p = tp[0] == CSI ? tp + 1 : tp + 2;
Karsten Hopp b3fcd8
--- 4170,4200 ----
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  #ifdef FEAT_TERMRESPONSE
Karsten Hopp b3fcd8
  	if (key_name[0] == NUL
Karsten Hopp b3fcd8
! 	    /* Mouse codes of DEC, pterm, and URXVT start with <ESC>[.  When
Karsten Hopp b3fcd8
! 	     * detecting the start of these mouse codes they might as well be
Karsten Hopp b3fcd8
! 	     * another key code or terminal response. */
Karsten Hopp b3fcd8
! # ifdef FEAT_MOUSE_DEC
Karsten Hopp b3fcd8
! 	    || key_name[0] == KS_DEC_MOUSE
Karsten Hopp b3fcd8
! # endif
Karsten Hopp b3fcd8
! # ifdef FEAT_MOUSE_PTERM
Karsten Hopp b3fcd8
! 	    || key_name[0] == KS_PTERM_MOUSE
Karsten Hopp b3fcd8
! # endif
Karsten Hopp b3fcd8
! # ifdef FEAT_MOUSE_URXVT
Karsten Hopp b3fcd8
  	    || key_name[0] == KS_URXVT_MOUSE
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
! 	   )
Karsten Hopp b3fcd8
  	{
Karsten Hopp b3fcd8
! 	    /* Check for some responses from the terminal starting with
Karsten Hopp b3fcd8
! 	     * "<Esc>[" or CSI:
Karsten Hopp b3fcd8
  	     *
Karsten Hopp b3fcd8
! 	     * - Xterm version string: <Esc>[>{x};{vers};{y}c
Karsten Hopp b3fcd8
  	     *   Also eat other possible responses to t_RV, rxvt returns
Karsten Hopp b3fcd8
  	     *   "<Esc>[?1;2c". Also accept CSI instead of <Esc>[.
Karsten Hopp b3fcd8
  	     *   mrxvt has been reported to have "+" in the version. Assume
Karsten Hopp b3fcd8
  	     *   the escape sequence ends with a letter or one of "{|}~".
Karsten Hopp b3fcd8
  	     *
Karsten Hopp b3fcd8
! 	     * - Cursor position report: <Esc>[{row};{col}R
Karsten Hopp b3fcd8
! 	     *   The final byte must be 'R'. It is used for checking the
Karsten Hopp b3fcd8
  	     *   ambiguous-width character state.
Karsten Hopp b3fcd8
  	     */
Karsten Hopp b3fcd8
  	    p = tp[0] == CSI ? tp + 1 : tp + 2;
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 4269,4304 ****
Karsten Hopp b3fcd8
  		 * u7_status is not "sent", it may be from a previous Vim that
Karsten Hopp b3fcd8
  		 * just exited.  But not for <S-F3>, it sends something
Karsten Hopp b3fcd8
  		 * similar, check for row and column to make sense. */
Karsten Hopp b3fcd8
! 		if (j == 1 && tp[i] == 'R' && row_char == '2' && col >= 2)
Karsten Hopp b3fcd8
  		{
Karsten Hopp b3fcd8
! 		    char *aw = NULL;
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
! 		    LOG_TR("Received U7 status");
Karsten Hopp b3fcd8
! 		    u7_status = U7_GOT;
Karsten Hopp b3fcd8
  # ifdef FEAT_AUTOCMD
Karsten Hopp b3fcd8
! 		    did_cursorhold = TRUE;
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
! 		    if (col == 2)
Karsten Hopp b3fcd8
! 			aw = "single";
Karsten Hopp b3fcd8
! 		    else if (col == 3)
Karsten Hopp b3fcd8
! 			aw = "double";
Karsten Hopp b3fcd8
! 		    if (aw != NULL && STRCMP(aw, p_ambw) != 0)
Karsten Hopp b3fcd8
! 		    {
Karsten Hopp b3fcd8
! 			/* Setting the option causes a screen redraw. Do that
Karsten Hopp b3fcd8
! 			 * right away if possible, keeping any messages. */
Karsten Hopp b3fcd8
! 			set_option_value((char_u *)"ambw", 0L, (char_u *)aw, 0);
Karsten Hopp b3fcd8
! # ifdef DEBUG_TERMRESPONSE
Karsten Hopp b3fcd8
  			{
Karsten Hopp b3fcd8
! 			    char buf[100];
Karsten Hopp b3fcd8
! 			    int  r = redraw_asap(CLEAR);
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
! 			    sprintf(buf, "set 'ambiwidth', redraw_asap(): %d",
Karsten Hopp b3fcd8
! 									   r);
Karsten Hopp b3fcd8
! 			    log_tr(buf);
Karsten Hopp b3fcd8
! 			}
Karsten Hopp b3fcd8
  # else
Karsten Hopp b3fcd8
! 			redraw_asap(CLEAR);
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
  		    }
Karsten Hopp b3fcd8
  		    key_name[0] = (int)KS_EXTRA;
Karsten Hopp b3fcd8
  		    key_name[1] = (int)KE_IGNORE;
Karsten Hopp b3fcd8
--- 4234,4275 ----
Karsten Hopp b3fcd8
  		 * u7_status is not "sent", it may be from a previous Vim that
Karsten Hopp b3fcd8
  		 * just exited.  But not for <S-F3>, it sends something
Karsten Hopp b3fcd8
  		 * similar, check for row and column to make sense. */
Karsten Hopp b3fcd8
! 		if (j == 1 && tp[i] == 'R')
Karsten Hopp b3fcd8
  		{
Karsten Hopp b3fcd8
! 		    if (row_char == '2' && col >= 2)
Karsten Hopp b3fcd8
! 		    {
Karsten Hopp b3fcd8
! 			char *aw = NULL;
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
! 			LOG_TR("Received U7 status");
Karsten Hopp b3fcd8
! 			u7_status = U7_GOT;
Karsten Hopp b3fcd8
  # ifdef FEAT_AUTOCMD
Karsten Hopp b3fcd8
! 			did_cursorhold = TRUE;
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
! 			if (col == 2)
Karsten Hopp b3fcd8
! 			    aw = "single";
Karsten Hopp b3fcd8
! 			else if (col == 3)
Karsten Hopp b3fcd8
! 			    aw = "double";
Karsten Hopp b3fcd8
! 			if (aw != NULL && STRCMP(aw, p_ambw) != 0)
Karsten Hopp b3fcd8
  			{
Karsten Hopp b3fcd8
! 			    /* Setting the option causes a screen redraw. Do
Karsten Hopp b3fcd8
! 			     * that right away if possible, keeping any
Karsten Hopp b3fcd8
! 			     * messages. */
Karsten Hopp b3fcd8
! 			    set_option_value((char_u *)"ambw", 0L,
Karsten Hopp b3fcd8
! 					     (char_u *)aw, 0);
Karsten Hopp b3fcd8
! # ifdef DEBUG_TERMRESPONSE
Karsten Hopp b3fcd8
! 			    {
Karsten Hopp b3fcd8
! 				char buf[100];
Karsten Hopp b3fcd8
! 				int  r = redraw_asap(CLEAR);
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
! 				sprintf(buf,
Karsten Hopp b3fcd8
! 					"set 'ambiwidth', redraw_asap(): %d",
Karsten Hopp b3fcd8
! 					r);
Karsten Hopp b3fcd8
! 				log_tr(buf);
Karsten Hopp b3fcd8
! 			    }
Karsten Hopp b3fcd8
  # else
Karsten Hopp b3fcd8
! 			    redraw_asap(CLEAR);
Karsten Hopp b3fcd8
  # endif
Karsten Hopp b3fcd8
+ 			}
Karsten Hopp b3fcd8
  		    }
Karsten Hopp b3fcd8
  		    key_name[0] = (int)KS_EXTRA;
Karsten Hopp b3fcd8
  		    key_name[1] = (int)KE_IGNORE;
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 4563,4581 ****
Karsten Hopp b3fcd8
  			return -1;
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  		    /* when mouse reporting is SGR, add 32 to mouse code */
Karsten Hopp b3fcd8
!                     if (key_name[0] == KS_SGR_MOUSE)
Karsten Hopp b3fcd8
!                         mouse_code += 32;
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  		    mouse_col = getdigits(&p) - 1;
Karsten Hopp b3fcd8
  		    if (*p++ != ';')
Karsten Hopp b3fcd8
  			return -1;
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  		    mouse_row = getdigits(&p) - 1;
Karsten Hopp b3fcd8
!                     if (key_name[0] == KS_SGR_MOUSE && *p == 'm')
Karsten Hopp b3fcd8
  			mouse_code |= MOUSE_RELEASE;
Karsten Hopp b3fcd8
!                     else if (*p != 'M')
Karsten Hopp b3fcd8
  			return -1;
Karsten Hopp b3fcd8
!                     p++;
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  		    slen += (int)(p - (tp + slen));
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
--- 4534,4552 ----
Karsten Hopp b3fcd8
  			return -1;
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  		    /* when mouse reporting is SGR, add 32 to mouse code */
Karsten Hopp b3fcd8
! 		    if (key_name[0] == KS_SGR_MOUSE)
Karsten Hopp b3fcd8
! 			mouse_code += 32;
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  		    mouse_col = getdigits(&p) - 1;
Karsten Hopp b3fcd8
  		    if (*p++ != ';')
Karsten Hopp b3fcd8
  			return -1;
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  		    mouse_row = getdigits(&p) - 1;
Karsten Hopp b3fcd8
! 		    if (key_name[0] == KS_SGR_MOUSE && *p == 'm')
Karsten Hopp b3fcd8
  			mouse_code |= MOUSE_RELEASE;
Karsten Hopp b3fcd8
! 		    else if (*p != 'M')
Karsten Hopp b3fcd8
  			return -1;
Karsten Hopp b3fcd8
! 		    p++;
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
  		    slen += (int)(p - (tp + slen));
Karsten Hopp b3fcd8
  
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 4592,4598 ****
Karsten Hopp b3fcd8
  			for (slen2 = slen; slen2 < len; slen2++)
Karsten Hopp b3fcd8
  			{
Karsten Hopp b3fcd8
  			    if (tp[slen2] == 'M'
Karsten Hopp b3fcd8
!                                 || (key_name[0] == KS_SGR_MOUSE
Karsten Hopp b3fcd8
  							 && tp[slen2] == 'm'))
Karsten Hopp b3fcd8
  			    {
Karsten Hopp b3fcd8
  				cmd_complete = 1;
Karsten Hopp b3fcd8
--- 4563,4569 ----
Karsten Hopp b3fcd8
  			for (slen2 = slen; slen2 < len; slen2++)
Karsten Hopp b3fcd8
  			{
Karsten Hopp b3fcd8
  			    if (tp[slen2] == 'M'
Karsten Hopp b3fcd8
! 				    || (key_name[0] == KS_SGR_MOUSE
Karsten Hopp b3fcd8
  							 && tp[slen2] == 'm'))
Karsten Hopp b3fcd8
  			    {
Karsten Hopp b3fcd8
  				cmd_complete = 1;
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 5769,5774 ****
Karsten Hopp b3fcd8
--- 5740,5748 ----
Karsten Hopp b3fcd8
   * termcap codes from the terminal itself.
Karsten Hopp b3fcd8
   * We get them one by one to avoid a very long response string.
Karsten Hopp b3fcd8
   */
Karsten Hopp b3fcd8
+ static int xt_index_in = 0;
Karsten Hopp b3fcd8
+ static int xt_index_out = 0;
Karsten Hopp b3fcd8
+ 
Karsten Hopp b3fcd8
      static void
Karsten Hopp b3fcd8
  req_codes_from_term()
Karsten Hopp b3fcd8
  {
Karsten Hopp b3fcd8
*** ../vim-7.4.388/src/proto/term.pro	2014-07-09 19:13:45.007701718 +0200
Karsten Hopp b3fcd8
--- src/proto/term.pro	2014-07-30 17:04:40.791525930 +0200
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 34,41 ****
Karsten Hopp b3fcd8
  void settmode __ARGS((int tmode));
Karsten Hopp b3fcd8
  void starttermcap __ARGS((void));
Karsten Hopp b3fcd8
  void stoptermcap __ARGS((void));
Karsten Hopp b3fcd8
- int did_request_esc_sequence __ARGS((void));
Karsten Hopp b3fcd8
- void resume_get_esc_sequence __ARGS((void));
Karsten Hopp b3fcd8
  void may_req_termresponse __ARGS((void));
Karsten Hopp b3fcd8
  void may_req_ambiguous_char_width __ARGS((void));
Karsten Hopp b3fcd8
  int swapping_screen __ARGS((void));
Karsten Hopp b3fcd8
--- 34,39 ----
Karsten Hopp b3fcd8
*** ../vim-7.4.388/src/version.c	2014-07-30 16:44:17.503534723 +0200
Karsten Hopp b3fcd8
--- src/version.c	2014-07-30 17:03:13.715526556 +0200
Karsten Hopp b3fcd8
***************
Karsten Hopp b3fcd8
*** 736,737 ****
Karsten Hopp b3fcd8
--- 736,739 ----
Karsten Hopp b3fcd8
  {   /* Add new patch number below this line */
Karsten Hopp b3fcd8
+ /**/
Karsten Hopp b3fcd8
+     389,
Karsten Hopp b3fcd8
  /**/
Karsten Hopp b3fcd8
Karsten Hopp b3fcd8
-- 
Karsten Hopp b3fcd8
The only way the average employee can speak to an executive is by taking a
Karsten Hopp b3fcd8
second job as a golf caddie.
Karsten Hopp b3fcd8
				(Scott Adams - The Dilbert principle)
Karsten Hopp b3fcd8
Karsten Hopp b3fcd8
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp b3fcd8
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp b3fcd8
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp b3fcd8
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///