Karsten Hopp 6fd6d8
To: vim-dev@vim.org
Karsten Hopp 6fd6d8
Subject: patch 7.1.059
Karsten Hopp 6fd6d8
Fcc: outbox
Karsten Hopp 6fd6d8
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 6fd6d8
Mime-Version: 1.0
Karsten Hopp 6fd6d8
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 6fd6d8
Content-Transfer-Encoding: 8bit
Karsten Hopp 6fd6d8
------------
Karsten Hopp 6fd6d8
Karsten Hopp 6fd6d8
Patch 7.1.059
Karsten Hopp 6fd6d8
Problem:    When in Ex mode and doing "g/^/vi" and then pressing CTRL-C Vim
Karsten Hopp 6fd6d8
	    hangs and beeps. (Antony Scriven)
Karsten Hopp 6fd6d8
Solution:   Clear "got_int" in the main loop to avoid the hang.  When typing
Karsten Hopp 6fd6d8
	    CTRL-C twice in a row abort the ":g" command.  This is Vi
Karsten Hopp 6fd6d8
	    compatible.
Karsten Hopp 6fd6d8
Files:	    src/main.c
Karsten Hopp 6fd6d8
Karsten Hopp 6fd6d8
Karsten Hopp 6fd6d8
*** ../vim-7.1.058/src/main.c	Tue Jun 19 20:30:46 2007
Karsten Hopp 6fd6d8
--- src/main.c	Tue Aug  7 22:40:35 2007
Karsten Hopp 6fd6d8
***************
Karsten Hopp 6fd6d8
*** 954,960 ****
Karsten Hopp 6fd6d8
      int		cmdwin;	    /* TRUE when working in the command-line window */
Karsten Hopp 6fd6d8
      int		noexmode;   /* TRUE when return on entering Ex mode */
Karsten Hopp 6fd6d8
  {
Karsten Hopp 6fd6d8
!     oparg_T	oa;	/* operator arguments */
Karsten Hopp 6fd6d8
  
Karsten Hopp 6fd6d8
  #if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)
Karsten Hopp 6fd6d8
      /* Setup to catch a terminating error from the X server.  Just ignore
Karsten Hopp 6fd6d8
--- 954,961 ----
Karsten Hopp 6fd6d8
      int		cmdwin;	    /* TRUE when working in the command-line window */
Karsten Hopp 6fd6d8
      int		noexmode;   /* TRUE when return on entering Ex mode */
Karsten Hopp 6fd6d8
  {
Karsten Hopp 6fd6d8
!     oparg_T	oa;				/* operator arguments */
Karsten Hopp 6fd6d8
!     int		previous_got_int = FALSE;	/* "got_int" was TRUE */
Karsten Hopp 6fd6d8
  
Karsten Hopp 6fd6d8
  #if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)
Karsten Hopp 6fd6d8
      /* Setup to catch a terminating error from the X server.  Just ignore
Karsten Hopp 6fd6d8
***************
Karsten Hopp 6fd6d8
*** 1015,1026 ****
Karsten Hopp 6fd6d8
  		need_fileinfo = FALSE;
Karsten Hopp 6fd6d8
  	    }
Karsten Hopp 6fd6d8
  	}
Karsten Hopp 6fd6d8
! 	if (got_int && !global_busy)
Karsten Hopp 6fd6d8
  	{
Karsten Hopp 6fd6d8
! 	    if (!quit_more)
Karsten Hopp 6fd6d8
! 		(void)vgetc();		/* flush all buffers */
Karsten Hopp 6fd6d8
! 	    got_int = FALSE;
Karsten Hopp 6fd6d8
  	}
Karsten Hopp 6fd6d8
  	if (!exmode_active)
Karsten Hopp 6fd6d8
  	    msg_scroll = FALSE;
Karsten Hopp 6fd6d8
  	quit_more = FALSE;
Karsten Hopp 6fd6d8
--- 1016,1047 ----
Karsten Hopp 6fd6d8
  		need_fileinfo = FALSE;
Karsten Hopp 6fd6d8
  	    }
Karsten Hopp 6fd6d8
  	}
Karsten Hopp 6fd6d8
! 
Karsten Hopp 6fd6d8
! 	/* Reset "got_int" now that we got back to the main loop.  Except when
Karsten Hopp 6fd6d8
! 	 * inside a ":g/pat/cmd" command, then the "got_int" needs to abort
Karsten Hopp 6fd6d8
! 	 * the ":g" command.
Karsten Hopp 6fd6d8
! 	 * For ":g/pat/vi" we reset "got_int" when used once.  When used
Karsten Hopp 6fd6d8
! 	 * a second time we go back to Ex mode and abort the ":g" command. */
Karsten Hopp 6fd6d8
! 	if (got_int)
Karsten Hopp 6fd6d8
  	{
Karsten Hopp 6fd6d8
! 	    if (noexmode && global_busy && !exmode_active && previous_got_int)
Karsten Hopp 6fd6d8
! 	    {
Karsten Hopp 6fd6d8
! 		/* Typed two CTRL-C in a row: go back to ex mode as if "Q" was
Karsten Hopp 6fd6d8
! 		 * used and keep "got_int" set, so that it aborts ":g". */
Karsten Hopp 6fd6d8
! 		exmode_active = EXMODE_NORMAL;
Karsten Hopp 6fd6d8
! 		State = NORMAL;
Karsten Hopp 6fd6d8
! 	    }
Karsten Hopp 6fd6d8
! 	    else if (!global_busy || !exmode_active)
Karsten Hopp 6fd6d8
! 	    {
Karsten Hopp 6fd6d8
! 		if (!quit_more)
Karsten Hopp 6fd6d8
! 		    (void)vgetc();		/* flush all buffers */
Karsten Hopp 6fd6d8
! 		got_int = FALSE;
Karsten Hopp 6fd6d8
! 	    }
Karsten Hopp 6fd6d8
! 	    previous_got_int = TRUE;
Karsten Hopp 6fd6d8
  	}
Karsten Hopp 6fd6d8
+ 	else
Karsten Hopp 6fd6d8
+ 	    previous_got_int = FALSE;
Karsten Hopp 6fd6d8
+ 
Karsten Hopp 6fd6d8
  	if (!exmode_active)
Karsten Hopp 6fd6d8
  	    msg_scroll = FALSE;
Karsten Hopp 6fd6d8
  	quit_more = FALSE;
Karsten Hopp 6fd6d8
*** ../vim-7.1.058/src/version.c	Wed Aug  8 22:48:16 2007
Karsten Hopp 6fd6d8
--- src/version.c	Fri Aug 10 21:30:39 2007
Karsten Hopp 6fd6d8
***************
Karsten Hopp 6fd6d8
*** 668,669 ****
Karsten Hopp 6fd6d8
--- 668,671 ----
Karsten Hopp 6fd6d8
  {   /* Add new patch number below this line */
Karsten Hopp 6fd6d8
+ /**/
Karsten Hopp 6fd6d8
+     59,
Karsten Hopp 6fd6d8
  /**/
Karsten Hopp 6fd6d8
Karsten Hopp 6fd6d8
-- 
Karsten Hopp 6fd6d8
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 6fd6d8
116. You are living with your boyfriend who networks your respective
Karsten Hopp 6fd6d8
     computers so you can sit in separate rooms and email each other
Karsten Hopp 6fd6d8
Karsten Hopp 6fd6d8
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 6fd6d8
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 6fd6d8
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 6fd6d8
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///