Karsten Hopp 952ed8
To: vim_dev@googlegroups.com
Karsten Hopp 952ed8
Subject: Patch 7.3.353
Karsten Hopp 952ed8
Fcc: outbox
Karsten Hopp 952ed8
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 952ed8
Mime-Version: 1.0
Karsten Hopp 952ed8
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 952ed8
Content-Transfer-Encoding: 8bit
Karsten Hopp 952ed8
------------
Karsten Hopp 952ed8
Karsten Hopp 952ed8
Patch 7.3.353 (after 7.3.343)
Karsten Hopp 952ed8
Problem:    Missing part of the urxvt patch.
Karsten Hopp 952ed8
Solution:   Add the change in term.c
Karsten Hopp 952ed8
Files:	    src/term.c
Karsten Hopp 952ed8
Karsten Hopp 952ed8
Karsten Hopp 952ed8
*** ../vim-7.3.352/src/term.c	2011-09-14 14:43:21.000000000 +0200
Karsten Hopp 952ed8
--- src/term.c	2011-10-26 23:48:01.000000000 +0200
Karsten Hopp 952ed8
***************
Karsten Hopp 952ed8
*** 4008,4014 ****
Karsten Hopp 952ed8
  	}
Karsten Hopp 952ed8
  
Karsten Hopp 952ed8
  #ifdef FEAT_TERMRESPONSE
Karsten Hopp 952ed8
! 	if (key_name[0] == NUL)
Karsten Hopp 952ed8
  	{
Karsten Hopp 952ed8
  	    /* Check for xterm version string: "<Esc>[>{x};{vers};{y}c".  Also
Karsten Hopp 952ed8
  	     * eat other possible responses to t_RV, rxvt returns
Karsten Hopp 952ed8
--- 4008,4016 ----
Karsten Hopp 952ed8
  	}
Karsten Hopp 952ed8
  
Karsten Hopp 952ed8
  #ifdef FEAT_TERMRESPONSE
Karsten Hopp 952ed8
! 	if (key_name[0] == NUL
Karsten Hopp 952ed8
! 	    /* URXVT mouse uses <ESC>[#;#;#M, but we are matching <ESC>[ */
Karsten Hopp 952ed8
! 	    || key_name[0] == KS_URXVT_MOUSE)
Karsten Hopp 952ed8
  	{
Karsten Hopp 952ed8
  	    /* Check for xterm version string: "<Esc>[>{x};{vers};{y}c".  Also
Karsten Hopp 952ed8
  	     * eat other possible responses to t_RV, rxvt returns
Karsten Hopp 952ed8
***************
Karsten Hopp 952ed8
*** 4047,4053 ****
Karsten Hopp 952ed8
  		    if (tp[1 + (tp[0] != CSI)] == '>' && j == 2)
Karsten Hopp 952ed8
  		    {
Karsten Hopp 952ed8
  			/* if xterm version >= 95 use mouse dragging */
Karsten Hopp 952ed8
! 			if (extra >= 95)
Karsten Hopp 952ed8
  			    set_option_value((char_u *)"ttym", 0L,
Karsten Hopp 952ed8
  						       (char_u *)"xterm2", 0);
Karsten Hopp 952ed8
  			/* if xterm version >= 141 try to get termcap codes */
Karsten Hopp 952ed8
--- 4049,4055 ----
Karsten Hopp 952ed8
  		    if (tp[1 + (tp[0] != CSI)] == '>' && j == 2)
Karsten Hopp 952ed8
  		    {
Karsten Hopp 952ed8
  			/* if xterm version >= 95 use mouse dragging */
Karsten Hopp 952ed8
! 			if (extra >= 95 && ttym_flags != TTYM_URXVT)
Karsten Hopp 952ed8
  			    set_option_value((char_u *)"ttym", 0L,
Karsten Hopp 952ed8
  						       (char_u *)"xterm2", 0);
Karsten Hopp 952ed8
  			/* if xterm version >= 141 try to get termcap codes */
Karsten Hopp 952ed8
***************
Karsten Hopp 952ed8
*** 4141,4146 ****
Karsten Hopp 952ed8
--- 4143,4151 ----
Karsten Hopp 952ed8
  # ifdef FEAT_MOUSE_PTERM
Karsten Hopp 952ed8
  		|| key_name[0] == (int)KS_PTERM_MOUSE
Karsten Hopp 952ed8
  # endif
Karsten Hopp 952ed8
+ # ifdef FEAT_MOUSE_URXVT
Karsten Hopp 952ed8
+ 		|| key_name[0] == (int)KS_URXVT_MOUSE
Karsten Hopp 952ed8
+ # endif
Karsten Hopp 952ed8
  		)
Karsten Hopp 952ed8
  	{
Karsten Hopp 952ed8
  	    is_click = is_drag = FALSE;
Karsten Hopp 952ed8
***************
Karsten Hopp 952ed8
*** 4219,4225 ****
Karsten Hopp 952ed8
--- 4224,4292 ----
Karsten Hopp 952ed8
  		    else
Karsten Hopp 952ed8
  			break;
Karsten Hopp 952ed8
  		}
Karsten Hopp 952ed8
+ 	    }
Karsten Hopp 952ed8
+ 
Karsten Hopp 952ed8
+ # ifdef FEAT_MOUSE_URXVT
Karsten Hopp 952ed8
+ 	    if (key_name[0] == (int)KS_URXVT_MOUSE)
Karsten Hopp 952ed8
+ 	    {
Karsten Hopp 952ed8
+ 		for (;;)
Karsten Hopp 952ed8
+ 		{
Karsten Hopp 952ed8
+ 		    /* URXVT 1015 mouse reporting mode:
Karsten Hopp 952ed8
+ 		     * Almost identical to xterm mouse mode, except the values
Karsten Hopp 952ed8
+ 		     * are decimal instead of bytes.
Karsten Hopp 952ed8
+ 		     *
Karsten Hopp 952ed8
+ 		     * \033[%d;%d;%dM
Karsten Hopp 952ed8
+ 		     *		  ^-- row
Karsten Hopp 952ed8
+ 		     *	       ^----- column
Karsten Hopp 952ed8
+ 		     *	    ^-------- code
Karsten Hopp 952ed8
+ 		     */
Karsten Hopp 952ed8
+ 		    p = tp + slen;
Karsten Hopp 952ed8
+ 
Karsten Hopp 952ed8
+ 		    mouse_code = getdigits(&p);
Karsten Hopp 952ed8
+ 		    if (*p++ != ';')
Karsten Hopp 952ed8
+ 			return -1;
Karsten Hopp 952ed8
+ 
Karsten Hopp 952ed8
+ 		    mouse_col = getdigits(&p) - 1;
Karsten Hopp 952ed8
+ 		    if (*p++ != ';')
Karsten Hopp 952ed8
+ 			return -1;
Karsten Hopp 952ed8
+ 
Karsten Hopp 952ed8
+ 		    mouse_row = getdigits(&p) - 1;
Karsten Hopp 952ed8
+ 		    if (*p++ != 'M')
Karsten Hopp 952ed8
+ 			return -1;
Karsten Hopp 952ed8
+ 
Karsten Hopp 952ed8
+ 		    slen += (int)(p - (tp + slen));
Karsten Hopp 952ed8
+ 
Karsten Hopp 952ed8
+ 		    /* skip this one if next one has same code (like xterm
Karsten Hopp 952ed8
+ 		     * case) */
Karsten Hopp 952ed8
+ 		    j = termcodes[idx].len;
Karsten Hopp 952ed8
+ 		    if (STRNCMP(tp, tp + slen, (size_t)j) == 0) {
Karsten Hopp 952ed8
+ 			/* check if the command is complete by looking for the
Karsten Hopp 952ed8
+ 			 * M */
Karsten Hopp 952ed8
+ 			int slen2;
Karsten Hopp 952ed8
+ 			int cmd_complete = 0;
Karsten Hopp 952ed8
+ 			for (slen2 = slen; slen2 < len; slen2++) {
Karsten Hopp 952ed8
+ 			    if (tp[slen2] == 'M') {
Karsten Hopp 952ed8
+ 				cmd_complete = 1;
Karsten Hopp 952ed8
+ 				break;
Karsten Hopp 952ed8
+ 			    }
Karsten Hopp 952ed8
+ 			}
Karsten Hopp 952ed8
+ 			p += j;
Karsten Hopp 952ed8
+ 			if (cmd_complete && getdigits(&p) == mouse_code) {
Karsten Hopp 952ed8
+ 			    slen += j; /* skip the \033[ */
Karsten Hopp 952ed8
+ 			    continue;
Karsten Hopp 952ed8
+ 			}
Karsten Hopp 952ed8
+ 		    }
Karsten Hopp 952ed8
+ 		    break;
Karsten Hopp 952ed8
+ 		}
Karsten Hopp 952ed8
+ 	    }
Karsten Hopp 952ed8
+ # endif
Karsten Hopp 952ed8
  
Karsten Hopp 952ed8
+ 	if (key_name[0] == (int)KS_MOUSE
Karsten Hopp 952ed8
+ #ifdef FEAT_MOUSE_URXVT
Karsten Hopp 952ed8
+ 	    || key_name[0] == (int)KS_URXVT_MOUSE
Karsten Hopp 952ed8
+ #endif
Karsten Hopp 952ed8
+ 	    )
Karsten Hopp 952ed8
+ 	{
Karsten Hopp 952ed8
  #  if !defined(MSWIN) && !defined(MSDOS)
Karsten Hopp 952ed8
  		/*
Karsten Hopp 952ed8
  		 * Handle mouse events.
Karsten Hopp 952ed8
*** ../vim-7.3.352/src/version.c	2011-10-26 22:02:10.000000000 +0200
Karsten Hopp 952ed8
--- src/version.c	2011-10-26 23:43:26.000000000 +0200
Karsten Hopp 952ed8
***************
Karsten Hopp 952ed8
*** 716,717 ****
Karsten Hopp 952ed8
--- 716,719 ----
Karsten Hopp 952ed8
  {   /* Add new patch number below this line */
Karsten Hopp 952ed8
+ /**/
Karsten Hopp 952ed8
+     353,
Karsten Hopp 952ed8
  /**/
Karsten Hopp 952ed8
Karsten Hopp 952ed8
-- 
Karsten Hopp 952ed8
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 952ed8
99. The hum of a cooling fan and the click of keys is comforting to you.
Karsten Hopp 952ed8
Karsten Hopp 952ed8
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 952ed8
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 952ed8
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 952ed8
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///