lkundrak / rpms / vim

Forked from rpms/vim 4 years ago
Clone
69709a5
To: vim_dev@googlegroups.com
69709a5
Subject: Patch 7.4.305
69709a5
Fcc: outbox
69709a5
From: Bram Moolenaar <Bram@moolenaar.net>
69709a5
Mime-Version: 1.0
69709a5
Content-Type: text/plain; charset=UTF-8
69709a5
Content-Transfer-Encoding: 8bit
69709a5
------------
69709a5
69709a5
Patch 7.4.305
69709a5
Problem:    Making 'ttymouse' empty after the xterm version was requested
69709a5
	    causes problems. (Elijah Griffin)
69709a5
Solution:   Do not check for DEC mouse sequences when the xterm version was
69709a5
	    requested.  Also don't request the xterm version when DEC mouse
69709a5
	    was enabled.
69709a5
Files:	    src/term.c, src/os_unix.c, src/proto/term.pro, src/globals.h
69709a5
69709a5
69709a5
*** ../vim-7.4.304/src/term.c	2014-03-25 13:46:22.841832960 +0100
69709a5
--- src/term.c	2014-05-22 17:12:59.198299628 +0200
69709a5
***************
69709a5
*** 153,158 ****
69709a5
--- 153,163 ----
69709a5
  static char_u *vim_tgetstr __ARGS((char *s, char_u **pp));
69709a5
  #endif /* HAVE_TGETENT */
69709a5
  
69709a5
+ #if defined(FEAT_TERMRESPONSE)
69709a5
+ static int xt_index_in = 0;
69709a5
+ static int xt_index_out = 0;
69709a5
+ #endif
69709a5
+ 
69709a5
  static int  detected_8bit = FALSE;	/* detected 8-bit terminal */
69709a5
  
69709a5
  static struct builtin_term builtin_termcaps[] =
69709a5
***************
69709a5
*** 3259,3265 ****
69709a5
  	    may_req_termresponse();
69709a5
  	    /* Immediately check for a response.  If t_Co changes, we don't
69709a5
  	     * want to redraw with wrong colors first. */
69709a5
! 	    if (crv_status != CRV_GET)
69709a5
  		check_for_codes_from_term();
69709a5
  	}
69709a5
  #endif
69709a5
--- 3264,3270 ----
69709a5
  	    may_req_termresponse();
69709a5
  	    /* Immediately check for a response.  If t_Co changes, we don't
69709a5
  	     * want to redraw with wrong colors first. */
69709a5
! 	    if (crv_status == CRV_SENT)
69709a5
  		check_for_codes_from_term();
69709a5
  	}
69709a5
  #endif
69709a5
***************
69709a5
*** 3306,3311 ****
69709a5
--- 3311,3340 ----
69709a5
      }
69709a5
  }
69709a5
  
69709a5
+ #if defined(UNIX) || defined(PROTO)
69709a5
+ /*
69709a5
+  * Return TRUE when the xterm version was requested or anything else that
69709a5
+  * would send an ESC sequence back to Vim.
69709a5
+  * If not sent yet, prevent it from being sent soon.
69709a5
+  * Used to check whether it is OK to enable checking for DEC mouse codes,
69709a5
+  * which conflict with may xterm ESC sequences.
69709a5
+  */
69709a5
+     int
69709a5
+ did_request_esc_sequence()
69709a5
+ {
69709a5
+     if (crv_status == CRV_GET)
69709a5
+ 	crv_status = 0;
69709a5
+     if (u7_status == U7_GET)
69709a5
+ 	u7_status = 0;
69709a5
+     return crv_status == CRV_SENT || u7_status == U7_SENT
69709a5
+ # if defined(FEAT_TERMRESPONSE)
69709a5
+ 	|| xt_index_out > xt_index_in
69709a5
+ # endif
69709a5
+ 	;
69709a5
+ }
69709a5
+ #endif
69709a5
+ 
69709a5
+ 
69709a5
  #if defined(FEAT_TERMRESPONSE) || defined(PROTO)
69709a5
  /*
69709a5
   * Request version string (for xterm) when needed.
69709a5
***************
69709a5
*** 3319,3324 ****
69709a5
--- 3348,3355 ----
69709a5
   * Insert mode.
69709a5
   * On Unix only do it when both output and input are a tty (avoid writing
69709a5
   * request to terminal while reading from a file).
69709a5
+  * Do not do this when a mouse is being detected that starts with the same ESC
69709a5
+  * sequence as the termresponse.
69709a5
   * The result is caught in check_termcode().
69709a5
   */
69709a5
      void
69709a5
***************
69709a5
*** 3332,3337 ****
69709a5
--- 3363,3369 ----
69709a5
  # ifdef UNIX
69709a5
  	    && isatty(1)
69709a5
  	    && isatty(read_cmd_fd)
69709a5
+ 	    && !xterm_conflict_mouse
69709a5
  # endif
69709a5
  	    && *T_CRV != NUL)
69709a5
      {
69709a5
***************
69709a5
*** 5714,5722 ****
69709a5
   * termcap codes from the terminal itself.
69709a5
   * We get them one by one to avoid a very long response string.
69709a5
   */
69709a5
- static int xt_index_in = 0;
69709a5
- static int xt_index_out = 0;
69709a5
- 
69709a5
      static void
69709a5
  req_codes_from_term()
69709a5
  {
69709a5
--- 5746,5751 ----
69709a5
*** ../vim-7.4.304/src/os_unix.c	2014-05-13 20:19:53.573808877 +0200
69709a5
--- src/os_unix.c	2014-05-22 17:11:10.274301842 +0200
69709a5
***************
69709a5
*** 3667,3672 ****
69709a5
--- 3667,3674 ----
69709a5
      void
69709a5
  check_mouse_termcode()
69709a5
  {
69709a5
+     xterm_conflict_mouse = FALSE;
69709a5
+ 
69709a5
  # ifdef FEAT_MOUSE_XTERM
69709a5
      if (use_xterm_mouse()
69709a5
  # ifdef FEAT_MOUSE_URXVT
69709a5
***************
69709a5
*** 3711,3717 ****
69709a5
  # endif
69709a5
  
69709a5
  # ifdef FEAT_MOUSE_JSB
69709a5
!     /* conflicts with xterm mouse: "\033[" and "\033[M" ??? */
69709a5
      if (!use_xterm_mouse()
69709a5
  #  ifdef FEAT_GUI
69709a5
  	    && !gui.in_use
69709a5
--- 3713,3719 ----
69709a5
  # endif
69709a5
  
69709a5
  # ifdef FEAT_MOUSE_JSB
69709a5
!     /* There is no conflict, but it was disabled for xterm before. */
69709a5
      if (!use_xterm_mouse()
69709a5
  #  ifdef FEAT_GUI
69709a5
  	    && !gui.in_use
69709a5
***************
69709a5
*** 3738,3769 ****
69709a5
  # endif
69709a5
  
69709a5
  # ifdef FEAT_MOUSE_DEC
69709a5
!     /* conflicts with xterm mouse: "\033[" and "\033[M" */
69709a5
!     if (!use_xterm_mouse()
69709a5
  #  ifdef FEAT_GUI
69709a5
  	    && !gui.in_use
69709a5
  #  endif
69709a5
  	    )
69709a5
  	set_mouse_termcode(KS_DEC_MOUSE, (char_u *)(term_is_8bit(T_NAME)
69709a5
  		     ? IF_EB("\233", CSI_STR) : IF_EB("\033[", ESC_STR "[")));
69709a5
      else
69709a5
  	del_mouse_termcode(KS_DEC_MOUSE);
69709a5
  # endif
69709a5
  # ifdef FEAT_MOUSE_PTERM
69709a5
      /* same as the dec mouse */
69709a5
!     if (!use_xterm_mouse()
69709a5
  #  ifdef FEAT_GUI
69709a5
  	    && !gui.in_use
69709a5
  #  endif
69709a5
  	    )
69709a5
  	set_mouse_termcode(KS_PTERM_MOUSE,
69709a5
  				      (char_u *) IF_EB("\033[", ESC_STR "["));
69709a5
      else
69709a5
  	del_mouse_termcode(KS_PTERM_MOUSE);
69709a5
  # endif
69709a5
  # ifdef FEAT_MOUSE_URXVT
69709a5
      /* same as the dec mouse */
69709a5
!     if (use_xterm_mouse() == 3
69709a5
  #  ifdef FEAT_GUI
69709a5
  	    && !gui.in_use
69709a5
  #  endif
69709a5
--- 3740,3779 ----
69709a5
  # endif
69709a5
  
69709a5
  # ifdef FEAT_MOUSE_DEC
69709a5
!     /* Conflicts with xterm mouse: "\033[" and "\033[M".
69709a5
!      * Also conflicts with the xterm termresponse, skip this if it was
69709a5
!      * requested already. */
69709a5
!     if (!use_xterm_mouse() && !did_request_esc_sequence()
69709a5
  #  ifdef FEAT_GUI
69709a5
  	    && !gui.in_use
69709a5
  #  endif
69709a5
  	    )
69709a5
+     {
69709a5
  	set_mouse_termcode(KS_DEC_MOUSE, (char_u *)(term_is_8bit(T_NAME)
69709a5
  		     ? IF_EB("\233", CSI_STR) : IF_EB("\033[", ESC_STR "[")));
69709a5
+ 	xterm_conflict_mouse = TRUE;
69709a5
+     }
69709a5
      else
69709a5
  	del_mouse_termcode(KS_DEC_MOUSE);
69709a5
  # endif
69709a5
  # ifdef FEAT_MOUSE_PTERM
69709a5
      /* same as the dec mouse */
69709a5
!     if (!use_xterm_mouse() && !did_request_esc_sequence()
69709a5
  #  ifdef FEAT_GUI
69709a5
  	    && !gui.in_use
69709a5
  #  endif
69709a5
  	    )
69709a5
+     {
69709a5
  	set_mouse_termcode(KS_PTERM_MOUSE,
69709a5
  				      (char_u *) IF_EB("\033[", ESC_STR "["));
69709a5
+ 	xterm_conflict_mouse = TRUE;
69709a5
+     }
69709a5
      else
69709a5
  	del_mouse_termcode(KS_PTERM_MOUSE);
69709a5
  # endif
69709a5
  # ifdef FEAT_MOUSE_URXVT
69709a5
      /* same as the dec mouse */
69709a5
!     if (use_xterm_mouse() == 3 && !did_request_esc_sequence()
69709a5
  #  ifdef FEAT_GUI
69709a5
  	    && !gui.in_use
69709a5
  #  endif
69709a5
***************
69709a5
*** 3778,3783 ****
69709a5
--- 3788,3794 ----
69709a5
  	    mch_setmouse(FALSE);
69709a5
  	    setmouse();
69709a5
  	}
69709a5
+ 	xterm_conflict_mouse = TRUE;
69709a5
      }
69709a5
      else
69709a5
  	del_mouse_termcode(KS_URXVT_MOUSE);
69709a5
*** ../vim-7.4.304/src/proto/term.pro	2013-09-29 16:27:42.000000000 +0200
69709a5
--- src/proto/term.pro	2014-05-22 16:58:25.806317380 +0200
69709a5
***************
69709a5
*** 34,39 ****
69709a5
--- 34,40 ----
69709a5
  void settmode __ARGS((int tmode));
69709a5
  void starttermcap __ARGS((void));
69709a5
  void stoptermcap __ARGS((void));
69709a5
+ int did_request_esc_sequence __ARGS((void));
69709a5
  void may_req_termresponse __ARGS((void));
69709a5
  void may_req_ambiguous_char_width __ARGS((void));
69709a5
  int swapping_screen __ARGS((void));
69709a5
*** ../vim-7.4.304/src/globals.h	2014-04-06 20:45:40.123357453 +0200
69709a5
--- src/globals.h	2014-05-22 17:07:39.130306133 +0200
69709a5
***************
69709a5
*** 1333,1338 ****
69709a5
--- 1333,1341 ----
69709a5
  #if defined(UNIX) || defined(VMS)
69709a5
  EXTERN int	term_is_xterm INIT(= FALSE);	/* xterm-like 'term' */
69709a5
  #endif
69709a5
+ #if defined(UNIX)
69709a5
+ EXTERN int	xterm_conflict_mouse INIT(= FALSE);
69709a5
+ #endif
69709a5
  
69709a5
  #ifdef BACKSLASH_IN_FILENAME
69709a5
  EXTERN char	psepc INIT(= '\\');	/* normal path separator character */
69709a5
*** ../vim-7.4.304/src/version.c	2014-05-22 16:29:03.378353200 +0200
69709a5
--- src/version.c	2014-05-22 16:58:16.150317576 +0200
69709a5
***************
69709a5
*** 736,737 ****
69709a5
--- 736,739 ----
69709a5
  {   /* Add new patch number below this line */
69709a5
+ /**/
69709a5
+     305,
69709a5
  /**/
69709a5
69709a5
-- 
69709a5
hundred-and-one symptoms of being an internet addict:
69709a5
195. Your cat has its own home page.
69709a5
69709a5
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
69709a5
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
69709a5
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
69709a5
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///