ffe04b7
To: vim-dev@vim.org
ffe04b7
Subject: Patch 7.0.104
ffe04b7
Fcc: outbox
ffe04b7
From: Bram Moolenaar <Bram@moolenaar.net>
ffe04b7
Mime-Version: 1.0
ffe04b7
Content-Type: text/plain; charset=ISO-8859-1
ffe04b7
Content-Transfer-Encoding: 8bit
ffe04b7
------------
ffe04b7
ffe04b7
Patch 7.0.104
ffe04b7
Problem:    The CursorHoldI event only triggers once in Insert mode.  It also
ffe04b7
	    triggers after CTRL-V and other two-key commands.
ffe04b7
Solution:   Set "did_cursorhold" before getting a second key.  Reset
ffe04b7
	    "did_cursorhold" after handling a command.
ffe04b7
Files:	    src/edit.c, src/fileio.c
ffe04b7
ffe04b7
ffe04b7
*** ../vim-7.0.103/src/edit.c	Tue Aug 29 18:36:55 2006
ffe04b7
--- src/edit.c	Tue Sep 12 21:12:10 2006
ffe04b7
***************
ffe04b7
*** 707,712 ****
ffe04b7
--- 707,717 ----
ffe04b7
  	lastc = c;			/* remember previous char for CTRL-D */
ffe04b7
  	c = safe_vgetc();
ffe04b7
  
ffe04b7
+ #ifdef FEAT_AUTOCMD
ffe04b7
+ 	/* Don't want K_CURSORHOLD for the second key, e.g., after CTRL-V. */
ffe04b7
+ 	did_cursorhold = TRUE;
ffe04b7
+ #endif
ffe04b7
+ 
ffe04b7
  #ifdef FEAT_RIGHTLEFT
ffe04b7
  	if (p_hkmap && KeyTyped)
ffe04b7
  	    c = hkmap(c);		/* Hebrew mode mapping */
ffe04b7
***************
ffe04b7
*** 1388,1393 ****
ffe04b7
--- 1393,1404 ----
ffe04b7
  #endif
ffe04b7
  	    break;
ffe04b7
  	}   /* end of switch (c) */
ffe04b7
+ 
ffe04b7
+ #ifdef FEAT_AUTOCMD
ffe04b7
+ 	/* If typed something may trigger CursorHoldI again. */
ffe04b7
+ 	if (c != K_CURSORHOLD)
ffe04b7
+ 	    did_cursorhold = FALSE;
ffe04b7
+ #endif
ffe04b7
  
ffe04b7
  	/* If the cursor was moved we didn't just insert a space */
ffe04b7
  	if (arrow_used)
ffe04b7
*** ../vim-7.0.103/src/fileio.c	Sat Sep  9 14:51:43 2006
ffe04b7
--- src/fileio.c	Tue Sep 12 20:58:55 2006
ffe04b7
***************
ffe04b7
*** 8289,8295 ****
ffe04b7
  {
ffe04b7
      int		state;
ffe04b7
  
ffe04b7
!     if (!did_cursorhold && has_cursorhold() && !Recording)
ffe04b7
      {
ffe04b7
  	state = get_real_state();
ffe04b7
  	if (state == NORMAL_BUSY || (state & INSERT) != 0)
ffe04b7
--- 8289,8299 ----
ffe04b7
  {
ffe04b7
      int		state;
ffe04b7
  
ffe04b7
!     if (!did_cursorhold && has_cursorhold() && !Recording
ffe04b7
! #ifdef FEAT_INS_EXPAND
ffe04b7
! 	    && !ins_compl_active()
ffe04b7
! #endif
ffe04b7
! 	    )
ffe04b7
      {
ffe04b7
  	state = get_real_state();
ffe04b7
  	if (state == NORMAL_BUSY || (state & INSERT) != 0)
ffe04b7
*** ../vim-7.0.103/src/version.c	Thu Sep 14 10:48:00 2006
ffe04b7
--- src/version.c	Thu Sep 14 11:05:33 2006
ffe04b7
***************
ffe04b7
*** 668,669 ****
ffe04b7
--- 668,671 ----
ffe04b7
  {   /* Add new patch number below this line */
ffe04b7
+ /**/
ffe04b7
+     104,
ffe04b7
  /**/
ffe04b7
ffe04b7
-- 
ffe04b7
A hamburger walks into a bar, and the bartender says: "I'm sorry,
ffe04b7
but we don't serve food here."
ffe04b7
ffe04b7
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
ffe04b7
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
ffe04b7
\\\        download, build and distribute -- http://www.A-A-P.org        ///
ffe04b7
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///