Karsten Hopp 4f05e0
To: vim_dev@googlegroups.com
Karsten Hopp 4f05e0
Subject: Patch 7.3.343
Karsten Hopp 4f05e0
Fcc: outbox
Karsten Hopp 4f05e0
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 4f05e0
Mime-Version: 1.0
Karsten Hopp 4f05e0
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 4f05e0
Content-Transfer-Encoding: 8bit
Karsten Hopp 4f05e0
------------
Karsten Hopp 4f05e0
Karsten Hopp 4f05e0
Patch 7.3.343
Karsten Hopp 4f05e0
Problem:    No mouse support for urxvt.
Karsten Hopp 4f05e0
Solution:   Implement urxvt mouse support, also for > 252 columns.  (Yiding
Karsten Hopp 4f05e0
	    Jia)
Karsten Hopp 4f05e0
Files:	    src/feature.h, src/keymap.h, src/option.h, src/os_unix.c,
Karsten Hopp 4f05e0
	    src/term.c, src/version.c
Karsten Hopp 4f05e0
Karsten Hopp 4f05e0
Karsten Hopp 4f05e0
*** ../vim-7.3.342/src/feature.h	2011-05-19 13:40:47.000000000 +0200
Karsten Hopp 4f05e0
--- src/feature.h	2011-10-20 21:02:15.000000000 +0200
Karsten Hopp 4f05e0
***************
Karsten Hopp 4f05e0
*** 1053,1058 ****
Karsten Hopp 4f05e0
--- 1053,1061 ----
Karsten Hopp 4f05e0
  # ifdef FEAT_BIG
Karsten Hopp 4f05e0
  #  define FEAT_MOUSE_DEC
Karsten Hopp 4f05e0
  # endif
Karsten Hopp 4f05e0
+ # ifdef FEAT_BIG
Karsten Hopp 4f05e0
+ #  define FEAT_MOUSE_URXVT
Karsten Hopp 4f05e0
+ # endif
Karsten Hopp 4f05e0
  # if defined(FEAT_NORMAL) && (defined(MSDOS) || defined(WIN3264))
Karsten Hopp 4f05e0
  #  define DOS_MOUSE
Karsten Hopp 4f05e0
  # endif
Karsten Hopp 4f05e0
***************
Karsten Hopp 4f05e0
*** 1068,1080 ****
Karsten Hopp 4f05e0
  #if defined(FEAT_NORMAL) && defined(HAVE_SYSMOUSE)
Karsten Hopp 4f05e0
  # define FEAT_SYSMOUSE
Karsten Hopp 4f05e0
  #endif
Karsten Hopp 4f05e0
  /* Define FEAT_MOUSE when any of the above is defined or FEAT_GUI. */
Karsten Hopp 4f05e0
  #if !defined(FEAT_MOUSE_TTY) \
Karsten Hopp 4f05e0
  	&& (defined(FEAT_MOUSE_XTERM) \
Karsten Hopp 4f05e0
! 	    || defined(FEAT_MOUSE_NET) || defined(FEAT_MOUSE_DEC) \
Karsten Hopp 4f05e0
! 	    || defined(DOS_MOUSE) || defined(FEAT_MOUSE_GPM) \
Karsten Hopp 4f05e0
! 	    || defined(FEAT_MOUSE_JSB) || defined(FEAT_MOUSE_PTERM) \
Karsten Hopp 4f05e0
! 	    || defined(FEAT_SYSMOUSE))
Karsten Hopp 4f05e0
  # define FEAT_MOUSE_TTY		/* include non-GUI mouse support */
Karsten Hopp 4f05e0
  #endif
Karsten Hopp 4f05e0
  #if !defined(FEAT_MOUSE) && (defined(FEAT_MOUSE_TTY) || defined(FEAT_GUI))
Karsten Hopp 4f05e0
--- 1071,1093 ----
Karsten Hopp 4f05e0
  #if defined(FEAT_NORMAL) && defined(HAVE_SYSMOUSE)
Karsten Hopp 4f05e0
  # define FEAT_SYSMOUSE
Karsten Hopp 4f05e0
  #endif
Karsten Hopp 4f05e0
+ 
Karsten Hopp 4f05e0
+ /* urxvt is a small variation of mouse_xterm, and shares its code */
Karsten Hopp 4f05e0
+ #if defined(FEAT_MOUSE_URXVT) && !defined(FEAT_MOUSE_XTERM)
Karsten Hopp 4f05e0
+ # define FEAT_MOUSE_XTERM
Karsten Hopp 4f05e0
+ #endif
Karsten Hopp 4f05e0
+ 
Karsten Hopp 4f05e0
  /* Define FEAT_MOUSE when any of the above is defined or FEAT_GUI. */
Karsten Hopp 4f05e0
  #if !defined(FEAT_MOUSE_TTY) \
Karsten Hopp 4f05e0
  	&& (defined(FEAT_MOUSE_XTERM) \
Karsten Hopp 4f05e0
! 	    || defined(FEAT_MOUSE_NET) \
Karsten Hopp 4f05e0
! 	    || defined(FEAT_MOUSE_DEC) \
Karsten Hopp 4f05e0
! 	    || defined(DOS_MOUSE) \
Karsten Hopp 4f05e0
! 	    || defined(FEAT_MOUSE_GPM) \
Karsten Hopp 4f05e0
! 	    || defined(FEAT_MOUSE_JSB) \
Karsten Hopp 4f05e0
! 	    || defined(FEAT_MOUSE_PTERM) \
Karsten Hopp 4f05e0
! 	    || defined(FEAT_SYSMOUSE) \
Karsten Hopp 4f05e0
! 	    || defined(FEAT_MOUSE_URXVT))
Karsten Hopp 4f05e0
  # define FEAT_MOUSE_TTY		/* include non-GUI mouse support */
Karsten Hopp 4f05e0
  #endif
Karsten Hopp 4f05e0
  #if !defined(FEAT_MOUSE) && (defined(FEAT_MOUSE_TTY) || defined(FEAT_GUI))
Karsten Hopp 4f05e0
*** ../vim-7.3.342/src/keymap.h	2010-08-15 21:57:32.000000000 +0200
Karsten Hopp 4f05e0
--- src/keymap.h	2011-10-20 21:00:37.000000000 +0200
Karsten Hopp 4f05e0
***************
Karsten Hopp 4f05e0
*** 92,104 ****
Karsten Hopp 4f05e0
   */
Karsten Hopp 4f05e0
  #define KS_TEAROFF		244
Karsten Hopp 4f05e0
  
Karsten Hopp 4f05e0
! /* used for JSB term mouse */
Karsten Hopp 4f05e0
  #define KS_JSBTERM_MOUSE	243
Karsten Hopp 4f05e0
  
Karsten Hopp 4f05e0
! /* used a termcap entry that produces a normal character */
Karsten Hopp 4f05e0
  #define KS_KEY			242
Karsten Hopp 4f05e0
  
Karsten Hopp 4f05e0
! /* Used for the qnx pterm mouse */
Karsten Hopp 4f05e0
  #define KS_PTERM_MOUSE		241
Karsten Hopp 4f05e0
  
Karsten Hopp 4f05e0
  /* Used for click in a tab pages label. */
Karsten Hopp 4f05e0
--- 92,104 ----
Karsten Hopp 4f05e0
   */
Karsten Hopp 4f05e0
  #define KS_TEAROFF		244
Karsten Hopp 4f05e0
  
Karsten Hopp 4f05e0
! /* Used for JSB term mouse. */
Karsten Hopp 4f05e0
  #define KS_JSBTERM_MOUSE	243
Karsten Hopp 4f05e0
  
Karsten Hopp 4f05e0
! /* Used a termcap entry that produces a normal character. */
Karsten Hopp 4f05e0
  #define KS_KEY			242
Karsten Hopp 4f05e0
  
Karsten Hopp 4f05e0
! /* Used for the qnx pterm mouse. */
Karsten Hopp 4f05e0
  #define KS_PTERM_MOUSE		241
Karsten Hopp 4f05e0
  
Karsten Hopp 4f05e0
  /* Used for click in a tab pages label. */
Karsten Hopp 4f05e0
***************
Karsten Hopp 4f05e0
*** 107,112 ****
Karsten Hopp 4f05e0
--- 107,115 ----
Karsten Hopp 4f05e0
  /* Used for menu in a tab pages line. */
Karsten Hopp 4f05e0
  #define KS_TABMENU		239
Karsten Hopp 4f05e0
  
Karsten Hopp 4f05e0
+ /* Used for the urxvt mouse. */
Karsten Hopp 4f05e0
+ #define KS_URXVT_MOUSE		238
Karsten Hopp 4f05e0
+ 
Karsten Hopp 4f05e0
  /*
Karsten Hopp 4f05e0
   * Filler used after KS_SPECIAL and others
Karsten Hopp 4f05e0
   */
Karsten Hopp 4f05e0
*** ../vim-7.3.342/src/option.h	2011-09-30 14:44:49.000000000 +0200
Karsten Hopp 4f05e0
--- src/option.h	2011-10-20 19:38:59.000000000 +0200
Karsten Hopp 4f05e0
***************
Karsten Hopp 4f05e0
*** 819,825 ****
Karsten Hopp 4f05e0
  EXTERN char_u	*p_ttym;	/* 'ttymouse' */
Karsten Hopp 4f05e0
  EXTERN unsigned ttym_flags;
Karsten Hopp 4f05e0
  # ifdef IN_OPTION_C
Karsten Hopp 4f05e0
! static char *(p_ttym_values[]) = {"xterm", "xterm2", "dec", "netterm", "jsbterm", "pterm", NULL};
Karsten Hopp 4f05e0
  # endif
Karsten Hopp 4f05e0
  # define TTYM_XTERM		0x01
Karsten Hopp 4f05e0
  # define TTYM_XTERM2		0x02
Karsten Hopp 4f05e0
--- 819,825 ----
Karsten Hopp 4f05e0
  EXTERN char_u	*p_ttym;	/* 'ttymouse' */
Karsten Hopp 4f05e0
  EXTERN unsigned ttym_flags;
Karsten Hopp 4f05e0
  # ifdef IN_OPTION_C
Karsten Hopp 4f05e0
! static char *(p_ttym_values[]) = {"xterm", "xterm2", "dec", "netterm", "jsbterm", "pterm", "urxvt", NULL};
Karsten Hopp 4f05e0
  # endif
Karsten Hopp 4f05e0
  # define TTYM_XTERM		0x01
Karsten Hopp 4f05e0
  # define TTYM_XTERM2		0x02
Karsten Hopp 4f05e0
***************
Karsten Hopp 4f05e0
*** 827,832 ****
Karsten Hopp 4f05e0
--- 827,833 ----
Karsten Hopp 4f05e0
  # define TTYM_NETTERM		0x08
Karsten Hopp 4f05e0
  # define TTYM_JSBTERM		0x10
Karsten Hopp 4f05e0
  # define TTYM_PTERM		0x20
Karsten Hopp 4f05e0
+ # define TTYM_URXVT		0x40
Karsten Hopp 4f05e0
  #endif
Karsten Hopp 4f05e0
  EXTERN char_u	*p_udir;	/* 'undodir' */
Karsten Hopp 4f05e0
  EXTERN long	p_ul;		/* 'undolevels' */
Karsten Hopp 4f05e0
*** ../vim-7.3.342/src/os_unix.c	2011-10-12 21:04:15.000000000 +0200
Karsten Hopp 4f05e0
--- src/os_unix.c	2011-10-20 21:02:00.000000000 +0200
Karsten Hopp 4f05e0
***************
Karsten Hopp 4f05e0
*** 2158,2167 ****
Karsten Hopp 4f05e0
--- 2158,2170 ----
Karsten Hopp 4f05e0
   * Return non-zero when using an xterm mouse, according to 'ttymouse'.
Karsten Hopp 4f05e0
   * Return 1 for "xterm".
Karsten Hopp 4f05e0
   * Return 2 for "xterm2".
Karsten Hopp 4f05e0
+  * Return 3 for "urxvt".
Karsten Hopp 4f05e0
   */
Karsten Hopp 4f05e0
      int
Karsten Hopp 4f05e0
  use_xterm_mouse()
Karsten Hopp 4f05e0
  {
Karsten Hopp 4f05e0
+     if (ttym_flags == TTYM_URXVT)
Karsten Hopp 4f05e0
+ 	return 3;
Karsten Hopp 4f05e0
      if (ttym_flags == TTYM_XTERM2)
Karsten Hopp 4f05e0
  	return 2;
Karsten Hopp 4f05e0
      if (ttym_flags == TTYM_XTERM)
Karsten Hopp 4f05e0
***************
Karsten Hopp 4f05e0
*** 3318,3323 ****
Karsten Hopp 4f05e0
--- 3321,3337 ----
Karsten Hopp 4f05e0
  	return;
Karsten Hopp 4f05e0
  
Karsten Hopp 4f05e0
      xterm_mouse_vers = use_xterm_mouse();
Karsten Hopp 4f05e0
+ 
Karsten Hopp 4f05e0
+ # ifdef FEAT_MOUSE_URXVT
Karsten Hopp 4f05e0
+     if (ttym_flags == TTYM_URXVT) {
Karsten Hopp 4f05e0
+ 	out_str_nf((char_u *)
Karsten Hopp 4f05e0
+ 		   (on
Karsten Hopp 4f05e0
+ 		   ? IF_EB("\033[?1015h", ESC_STR "[?1015h")
Karsten Hopp 4f05e0
+ 		   : IF_EB("\033[?1015l", ESC_STR "[?1015l")));
Karsten Hopp 4f05e0
+ 	ison = on;
Karsten Hopp 4f05e0
+     }
Karsten Hopp 4f05e0
+ # endif
Karsten Hopp 4f05e0
+ 
Karsten Hopp 4f05e0
      if (xterm_mouse_vers > 0)
Karsten Hopp 4f05e0
      {
Karsten Hopp 4f05e0
  	if (on)	/* enable mouse events, use mouse tracking if available */
Karsten Hopp 4f05e0
***************
Karsten Hopp 4f05e0
*** 3434,3439 ****
Karsten Hopp 4f05e0
--- 3448,3456 ----
Karsten Hopp 4f05e0
  {
Karsten Hopp 4f05e0
  # ifdef FEAT_MOUSE_XTERM
Karsten Hopp 4f05e0
      if (use_xterm_mouse()
Karsten Hopp 4f05e0
+ # ifdef FEAT_MOUSE_URXVT
Karsten Hopp 4f05e0
+ 	    && use_xterm_mouse() != 3
Karsten Hopp 4f05e0
+ # endif
Karsten Hopp 4f05e0
  #  ifdef FEAT_GUI
Karsten Hopp 4f05e0
  	    && !gui.in_use
Karsten Hopp 4f05e0
  #  endif
Karsten Hopp 4f05e0
***************
Karsten Hopp 4f05e0
*** 3523,3528 ****
Karsten Hopp 4f05e0
--- 3540,3566 ----
Karsten Hopp 4f05e0
      else
Karsten Hopp 4f05e0
  	del_mouse_termcode(KS_PTERM_MOUSE);
Karsten Hopp 4f05e0
  # endif
Karsten Hopp 4f05e0
+ # ifdef FEAT_MOUSE_URXVT
Karsten Hopp 4f05e0
+     /* same as the dec mouse */
Karsten Hopp 4f05e0
+     if (use_xterm_mouse() == 3
Karsten Hopp 4f05e0
+ #  ifdef FEAT_GUI
Karsten Hopp 4f05e0
+ 	    && !gui.in_use
Karsten Hopp 4f05e0
+ #  endif
Karsten Hopp 4f05e0
+ 	    )
Karsten Hopp 4f05e0
+     {
Karsten Hopp 4f05e0
+ 	set_mouse_termcode(KS_URXVT_MOUSE, (char_u *)(term_is_8bit(T_NAME)
Karsten Hopp 4f05e0
+ 		    ? IF_EB("\233", CSI_STR)
Karsten Hopp 4f05e0
+ 		    : IF_EB("\033[", ESC_STR "[")));
Karsten Hopp 4f05e0
+ 
Karsten Hopp 4f05e0
+ 	if (*p_mouse != NUL)
Karsten Hopp 4f05e0
+ 	{
Karsten Hopp 4f05e0
+ 	    mch_setmouse(FALSE);
Karsten Hopp 4f05e0
+ 	    setmouse();
Karsten Hopp 4f05e0
+ 	}
Karsten Hopp 4f05e0
+     }
Karsten Hopp 4f05e0
+     else
Karsten Hopp 4f05e0
+ 	del_mouse_termcode(KS_URXVT_MOUSE);
Karsten Hopp 4f05e0
+ # endif
Karsten Hopp 4f05e0
  }
Karsten Hopp 4f05e0
  #endif
Karsten Hopp 4f05e0
  
Karsten Hopp 4f05e0
*** ../vim-7.3.342/src/version.c	2011-10-20 18:24:16.000000000 +0200
Karsten Hopp 4f05e0
--- src/version.c	2011-10-20 19:40:48.000000000 +0200
Karsten Hopp 4f05e0
***************
Karsten Hopp 4f05e0
*** 380,383 ****
Karsten Hopp 4f05e0
--- 380,388 ----
Karsten Hopp 4f05e0
  	"-mouse_xterm",
Karsten Hopp 4f05e0
  # endif
Karsten Hopp 4f05e0
+ # ifdef FEAT_MOUSE_URXVT
Karsten Hopp 4f05e0
+ 	"+mouse_urxvt",
Karsten Hopp 4f05e0
+ # else
Karsten Hopp 4f05e0
+ 	"-mouse_urxvt",
Karsten Hopp 4f05e0
+ # endif
Karsten Hopp 4f05e0
  #endif
Karsten Hopp 4f05e0
  #ifdef __QNX__
Karsten Hopp 4f05e0
***************
Karsten Hopp 4f05e0
*** 711,712 ****
Karsten Hopp 4f05e0
--- 716,719 ----
Karsten Hopp 4f05e0
  {   /* Add new patch number below this line */
Karsten Hopp 4f05e0
+ /**/
Karsten Hopp 4f05e0
+     343,
Karsten Hopp 4f05e0
  /**/
Karsten Hopp 4f05e0
Karsten Hopp 4f05e0
-- 
Karsten Hopp 4f05e0
Warning label on a superhero Halloween costume:
Karsten Hopp 4f05e0
"Caution: Cape does not enable user to fly."
Karsten Hopp 4f05e0
Karsten Hopp 4f05e0
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 4f05e0
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 4f05e0
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 4f05e0
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///