Blob Blame History Raw
To: vim-dev@vim.org
Subject: patch 7.1.059
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.1.059
Problem:    When in Ex mode and doing "g/^/vi" and then pressing CTRL-C Vim
	    hangs and beeps. (Antony Scriven)
Solution:   Clear "got_int" in the main loop to avoid the hang.  When typing
	    CTRL-C twice in a row abort the ":g" command.  This is Vi
	    compatible.
Files:	    src/main.c


*** ../vim-7.1.058/src/main.c	Tue Jun 19 20:30:46 2007
--- src/main.c	Tue Aug  7 22:40:35 2007
***************
*** 954,960 ****
      int		cmdwin;	    /* TRUE when working in the command-line window */
      int		noexmode;   /* TRUE when return on entering Ex mode */
  {
!     oparg_T	oa;	/* operator arguments */
  
  #if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)
      /* Setup to catch a terminating error from the X server.  Just ignore
--- 954,961 ----
      int		cmdwin;	    /* TRUE when working in the command-line window */
      int		noexmode;   /* TRUE when return on entering Ex mode */
  {
!     oparg_T	oa;				/* operator arguments */
!     int		previous_got_int = FALSE;	/* "got_int" was TRUE */
  
  #if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)
      /* Setup to catch a terminating error from the X server.  Just ignore
***************
*** 1015,1026 ****
  		need_fileinfo = FALSE;
  	    }
  	}
! 	if (got_int && !global_busy)
  	{
! 	    if (!quit_more)
! 		(void)vgetc();		/* flush all buffers */
! 	    got_int = FALSE;
  	}
  	if (!exmode_active)
  	    msg_scroll = FALSE;
  	quit_more = FALSE;
--- 1016,1047 ----
  		need_fileinfo = FALSE;
  	    }
  	}
! 
! 	/* Reset "got_int" now that we got back to the main loop.  Except when
! 	 * inside a ":g/pat/cmd" command, then the "got_int" needs to abort
! 	 * the ":g" command.
! 	 * For ":g/pat/vi" we reset "got_int" when used once.  When used
! 	 * a second time we go back to Ex mode and abort the ":g" command. */
! 	if (got_int)
  	{
! 	    if (noexmode && global_busy && !exmode_active && previous_got_int)
! 	    {
! 		/* Typed two CTRL-C in a row: go back to ex mode as if "Q" was
! 		 * used and keep "got_int" set, so that it aborts ":g". */
! 		exmode_active = EXMODE_NORMAL;
! 		State = NORMAL;
! 	    }
! 	    else if (!global_busy || !exmode_active)
! 	    {
! 		if (!quit_more)
! 		    (void)vgetc();		/* flush all buffers */
! 		got_int = FALSE;
! 	    }
! 	    previous_got_int = TRUE;
  	}
+ 	else
+ 	    previous_got_int = FALSE;
+ 
  	if (!exmode_active)
  	    msg_scroll = FALSE;
  	quit_more = FALSE;
*** ../vim-7.1.058/src/version.c	Wed Aug  8 22:48:16 2007
--- src/version.c	Fri Aug 10 21:30:39 2007
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     59,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
116. You are living with your boyfriend who networks your respective
     computers so you can sit in separate rooms and email each other

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///