Karsten Hopp 124d85
To: vim_dev@googlegroups.com
Karsten Hopp 124d85
Subject: Patch 7.3.647
Karsten Hopp 124d85
Fcc: outbox
Karsten Hopp 124d85
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 124d85
Mime-Version: 1.0
Karsten Hopp 124d85
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 124d85
Content-Transfer-Encoding: 8bit
Karsten Hopp 124d85
------------
Karsten Hopp 124d85
Karsten Hopp 124d85
Patch 7.3.647
Karsten Hopp 124d85
Problem:    "gnd" doesn't work correctly in Visual mode.
Karsten Hopp 124d85
Solution:   Handle Visual mode differently in "gn". (Christian Brabandt)
Karsten Hopp 124d85
Files:	    src/search.c, src/testdir/test53.in, src/testdir/test53.ok
Karsten Hopp 124d85
Karsten Hopp 124d85
Karsten Hopp 124d85
*** ../vim-7.3.646/src/search.c	2012-08-23 15:53:00.000000000 +0200
Karsten Hopp 124d85
--- src/search.c	2012-09-05 12:11:58.000000000 +0200
Karsten Hopp 124d85
***************
Karsten Hopp 124d85
*** 4545,4551 ****
Karsten Hopp 124d85
      int		dir;
Karsten Hopp 124d85
      int		result;		/* result of various function calls */
Karsten Hopp 124d85
      char_u	old_p_ws = p_ws;
Karsten Hopp 124d85
-     int		visual_active = FALSE;
Karsten Hopp 124d85
      int		flags = 0;
Karsten Hopp 124d85
      pos_T	save_VIsual;
Karsten Hopp 124d85
      int		zerowidth = FALSE;
Karsten Hopp 124d85
--- 4545,4550 ----
Karsten Hopp 124d85
***************
Karsten Hopp 124d85
*** 4561,4571 ****
Karsten Hopp 124d85
      {
Karsten Hopp 124d85
  	orig_pos = curwin->w_cursor;
Karsten Hopp 124d85
  	save_VIsual = VIsual;
Karsten Hopp 124d85
- 	visual_active = TRUE;
Karsten Hopp 124d85
- 
Karsten Hopp 124d85
- 	/* just started visual selection, only one character */
Karsten Hopp 124d85
- 	if (equalpos(VIsual, curwin->w_cursor))
Karsten Hopp 124d85
- 	    visual_active = FALSE;
Karsten Hopp 124d85
  
Karsten Hopp 124d85
  	pos = curwin->w_cursor;
Karsten Hopp 124d85
  	start_pos = VIsual;
Karsten Hopp 124d85
--- 4560,4565 ----
Karsten Hopp 124d85
***************
Karsten Hopp 124d85
*** 4619,4625 ****
Karsten Hopp 124d85
  	    p_ws = old_p_ws;
Karsten Hopp 124d85
  	    return FAIL;
Karsten Hopp 124d85
  	}
Karsten Hopp 124d85
! 	else if (!i && !result && !visual_active)
Karsten Hopp 124d85
  	{
Karsten Hopp 124d85
  	    if (forward) /* try again from start of buffer */
Karsten Hopp 124d85
  	    {
Karsten Hopp 124d85
--- 4613,4619 ----
Karsten Hopp 124d85
  	    p_ws = old_p_ws;
Karsten Hopp 124d85
  	    return FAIL;
Karsten Hopp 124d85
  	}
Karsten Hopp 124d85
! 	else if (!i && !result)
Karsten Hopp 124d85
  	{
Karsten Hopp 124d85
  	    if (forward) /* try again from start of buffer */
Karsten Hopp 124d85
  	    {
Karsten Hopp 124d85
***************
Karsten Hopp 124d85
*** 4691,4697 ****
Karsten Hopp 124d85
      regmmatch_T	regmatch;
Karsten Hopp 124d85
      int		nmatched = 0;
Karsten Hopp 124d85
      int		result = -1;
Karsten Hopp 124d85
!     pos_T       pos;
Karsten Hopp 124d85
  
Karsten Hopp 124d85
      if (search_regcomp(pattern, RE_SEARCH, RE_SEARCH,
Karsten Hopp 124d85
  					      SEARCH_KEEP, &regmatch) == FAIL)
Karsten Hopp 124d85
--- 4685,4692 ----
Karsten Hopp 124d85
      regmmatch_T	regmatch;
Karsten Hopp 124d85
      int		nmatched = 0;
Karsten Hopp 124d85
      int		result = -1;
Karsten Hopp 124d85
!     pos_T	pos;
Karsten Hopp 124d85
!     int		save_called_emsg = called_emsg;
Karsten Hopp 124d85
  
Karsten Hopp 124d85
      if (search_regcomp(pattern, RE_SEARCH, RE_SEARCH,
Karsten Hopp 124d85
  					      SEARCH_KEEP, &regmatch) == FAIL)
Karsten Hopp 124d85
***************
Karsten Hopp 124d85
*** 4704,4718 ****
Karsten Hopp 124d85
      {
Karsten Hopp 124d85
  	/* Zero-width pattern should match somewhere, then we can check if
Karsten Hopp 124d85
  	 * start and end are in the same position. */
Karsten Hopp 124d85
  	nmatched = vim_regexec_multi(&regmatch, curwin, curbuf,
Karsten Hopp 124d85
  						  pos.lnum, (colnr_T)0, NULL);
Karsten Hopp 124d85
  
Karsten Hopp 124d85
  	if (!called_emsg)
Karsten Hopp 124d85
  	    result = (nmatched != 0
Karsten Hopp 124d85
! 		    && regmatch.startpos[0].lnum == regmatch.endpos[0].lnum
Karsten Hopp 124d85
! 		    && regmatch.startpos[0].col == regmatch.endpos[0].col);
Karsten Hopp 124d85
      }
Karsten Hopp 124d85
  
Karsten Hopp 124d85
      vim_free(regmatch.regprog);
Karsten Hopp 124d85
      return result;
Karsten Hopp 124d85
  }
Karsten Hopp 124d85
--- 4699,4715 ----
Karsten Hopp 124d85
      {
Karsten Hopp 124d85
  	/* Zero-width pattern should match somewhere, then we can check if
Karsten Hopp 124d85
  	 * start and end are in the same position. */
Karsten Hopp 124d85
+ 	called_emsg = FALSE;
Karsten Hopp 124d85
  	nmatched = vim_regexec_multi(&regmatch, curwin, curbuf,
Karsten Hopp 124d85
  						  pos.lnum, (colnr_T)0, NULL);
Karsten Hopp 124d85
  
Karsten Hopp 124d85
  	if (!called_emsg)
Karsten Hopp 124d85
  	    result = (nmatched != 0
Karsten Hopp 124d85
! 		&& regmatch.startpos[0].lnum == regmatch.endpos[0].lnum
Karsten Hopp 124d85
! 		&& regmatch.startpos[0].col == regmatch.endpos[0].col);
Karsten Hopp 124d85
      }
Karsten Hopp 124d85
  
Karsten Hopp 124d85
+     called_emsg |= save_called_emsg;
Karsten Hopp 124d85
      vim_free(regmatch.regprog);
Karsten Hopp 124d85
      return result;
Karsten Hopp 124d85
  }
Karsten Hopp 124d85
*** ../vim-7.3.646/src/testdir/test53.in	2012-08-29 16:55:09.000000000 +0200
Karsten Hopp 124d85
--- src/testdir/test53.in	2012-09-05 12:12:03.000000000 +0200
Karsten Hopp 124d85
***************
Karsten Hopp 124d85
*** 40,46 ****
Karsten Hopp 124d85
  /\>\zs
Karsten Hopp 124d85
  0gnd/^
Karsten Hopp 124d85
  gnd$h/\zs
Karsten Hopp 124d85
! gnd
Karsten Hopp 124d85
  :/^start:/,/^end:/wq! test.out
Karsten Hopp 124d85
  ENDTEST
Karsten Hopp 124d85
  
Karsten Hopp 124d85
--- 40,47 ----
Karsten Hopp 124d85
  /\>\zs
Karsten Hopp 124d85
  0gnd/^
Karsten Hopp 124d85
  gnd$h/\zs
Karsten Hopp 124d85
! gnd/[u]niquepattern/s
Karsten Hopp 124d85
! vlgnd
Karsten Hopp 124d85
  :/^start:/,/^end:/wq! test.out
Karsten Hopp 124d85
  ENDTEST
Karsten Hopp 124d85
  
Karsten Hopp 124d85
***************
Karsten Hopp 124d85
*** 67,70 ****
Karsten Hopp 124d85
--- 68,72 ----
Karsten Hopp 124d85
  lines
Karsten Hopp 124d85
  zero width pattern
Karsten Hopp 124d85
  delete first and last chars
Karsten Hopp 124d85
+ uniquepattern uniquepattern
Karsten Hopp 124d85
  end:
Karsten Hopp 124d85
*** ../vim-7.3.646/src/testdir/test53.ok	2012-08-29 16:55:09.000000000 +0200
Karsten Hopp 124d85
--- src/testdir/test53.ok	2012-09-05 12:12:08.000000000 +0200
Karsten Hopp 124d85
***************
Karsten Hopp 124d85
*** 24,27 ****
Karsten Hopp 124d85
--- 24,28 ----
Karsten Hopp 124d85
  join lines
Karsten Hopp 124d85
  zerowidth pattern
Karsten Hopp 124d85
  elete first and last char
Karsten Hopp 124d85
+  uniquepattern
Karsten Hopp 124d85
  end:
Karsten Hopp 124d85
*** ../vim-7.3.646/src/version.c	2012-08-29 18:50:50.000000000 +0200
Karsten Hopp 124d85
--- src/version.c	2012-09-05 12:13:37.000000000 +0200
Karsten Hopp 124d85
***************
Karsten Hopp 124d85
*** 721,722 ****
Karsten Hopp 124d85
--- 721,724 ----
Karsten Hopp 124d85
  {   /* Add new patch number below this line */
Karsten Hopp 124d85
+ /**/
Karsten Hopp 124d85
+     647,
Karsten Hopp 124d85
  /**/
Karsten Hopp 124d85
Karsten Hopp 124d85
-- 
Karsten Hopp 124d85
        **  Hello and Welcome to the Psychiatric Hotline **
Karsten Hopp 124d85
If you are obsessive-compulsive, please press 1 repeatedly.
Karsten Hopp 124d85
If you are co-dependent, please ask someone to press 2.
Karsten Hopp 124d85
If you have multiple personalities, please press 3, 4, 5 and 6.
Karsten Hopp 124d85
If you are paranoid-delusional, we know who you are and what you want
Karsten Hopp 124d85
       - just stay on the line so we can trace the call.
Karsten Hopp 124d85
If you are schizophrenic, listen carefully and a little voice will
Karsten Hopp 124d85
       tell you which number to press next.
Karsten Hopp 124d85
If you are manic-depressive, it doesn't matter which number you press
Karsten Hopp 124d85
       - no one will answer.
Karsten Hopp 124d85
If you suffer from panic attacks, push every button you can find.
Karsten Hopp 124d85
If you are sane, please hold on - we have the rest of humanity on the
Karsten Hopp 124d85
        other line and they desparately want to ask you a few questions.
Karsten Hopp 124d85
Karsten Hopp 124d85
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 124d85
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 124d85
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 124d85
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///