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