Karsten Hopp 7e5694
To: vim-dev@vim.org
Karsten Hopp 7e5694
Subject: Patch 7.1.245
Karsten Hopp 7e5694
Fcc: outbox
Karsten Hopp 7e5694
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 7e5694
Mime-Version: 1.0
Karsten Hopp 7e5694
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 7e5694
Content-Transfer-Encoding: 8bit
Karsten Hopp 7e5694
------------
Karsten Hopp 7e5694
Karsten Hopp 7e5694
Patch 7.1.245
Karsten Hopp 7e5694
Problem:    Pressing CTRL-\ three times causes Vim to quit.  (Ranganath Rao).
Karsten Hopp 7e5694
	    Also for f CTRL-\ CTRL-\.
Karsten Hopp 7e5694
Solution:   When going to cooked mode in mch_delay() set a flag to ignore
Karsten Hopp 7e5694
	    SIGQUIT.
Karsten Hopp 7e5694
Files:	    src/os_unix.c
Karsten Hopp 7e5694
Karsten Hopp 7e5694
Karsten Hopp 7e5694
*** ../vim-7.1.244/src/os_unix.c	Sun Jan 13 16:30:23 2008
Karsten Hopp 7e5694
--- src/os_unix.c	Sun Feb 10 22:07:27 2008
Karsten Hopp 7e5694
***************
Karsten Hopp 7e5694
*** 195,200 ****
Karsten Hopp 7e5694
--- 195,201 ----
Karsten Hopp 7e5694
  static int	show_shell_mess = TRUE;
Karsten Hopp 7e5694
  #endif
Karsten Hopp 7e5694
  static int	deadly_signal = 0;	    /* The signal we caught */
Karsten Hopp 7e5694
+ static int	in_mch_delay = FALSE;	    /* sleeping in mch_delay() */
Karsten Hopp 7e5694
  
Karsten Hopp 7e5694
  static int curr_tmode = TMODE_COOK;	/* contains current terminal mode */
Karsten Hopp 7e5694
  
Karsten Hopp 7e5694
***************
Karsten Hopp 7e5694
*** 538,544 ****
Karsten Hopp 7e5694
      if (ignoreinput)
Karsten Hopp 7e5694
      {
Karsten Hopp 7e5694
  	/* Go to cooked mode without echo, to allow SIGINT interrupting us
Karsten Hopp 7e5694
! 	 * here */
Karsten Hopp 7e5694
  	old_tmode = curr_tmode;
Karsten Hopp 7e5694
  	if (curr_tmode == TMODE_RAW)
Karsten Hopp 7e5694
  	    settmode(TMODE_SLEEP);
Karsten Hopp 7e5694
--- 539,547 ----
Karsten Hopp 7e5694
      if (ignoreinput)
Karsten Hopp 7e5694
      {
Karsten Hopp 7e5694
  	/* Go to cooked mode without echo, to allow SIGINT interrupting us
Karsten Hopp 7e5694
! 	 * here.  But we don't want QUIT to kill us (CTRL-\ used in a
Karsten Hopp 7e5694
! 	 * shell may produce SIGQUIT). */
Karsten Hopp 7e5694
! 	in_mch_delay = TRUE;
Karsten Hopp 7e5694
  	old_tmode = curr_tmode;
Karsten Hopp 7e5694
  	if (curr_tmode == TMODE_RAW)
Karsten Hopp 7e5694
  	    settmode(TMODE_SLEEP);
Karsten Hopp 7e5694
***************
Karsten Hopp 7e5694
*** 602,607 ****
Karsten Hopp 7e5694
--- 605,611 ----
Karsten Hopp 7e5694
  #endif
Karsten Hopp 7e5694
  
Karsten Hopp 7e5694
  	settmode(old_tmode);
Karsten Hopp 7e5694
+ 	in_mch_delay = FALSE;
Karsten Hopp 7e5694
      }
Karsten Hopp 7e5694
      else
Karsten Hopp 7e5694
  	WaitForChar(msec);
Karsten Hopp 7e5694
***************
Karsten Hopp 7e5694
*** 922,927 ****
Karsten Hopp 7e5694
--- 926,939 ----
Karsten Hopp 7e5694
  #endif
Karsten Hopp 7e5694
  
Karsten Hopp 7e5694
  #ifdef SIGHASARG
Karsten Hopp 7e5694
+ # ifdef SIGQUIT
Karsten Hopp 7e5694
+     /* While in mch_delay() we go to cooked mode to allow a CTRL-C to
Karsten Hopp 7e5694
+      * interrupt us.  But in cooked mode we may also get SIGQUIT, e.g., when
Karsten Hopp 7e5694
+      * pressing CTRL-\, but we don't want Vim to exit then. */
Karsten Hopp 7e5694
+     if (in_mch_delay && sigarg == SIGQUIT)
Karsten Hopp 7e5694
+ 	SIGRETURN;
Karsten Hopp 7e5694
+ # endif
Karsten Hopp 7e5694
+ 
Karsten Hopp 7e5694
      /* When SIGHUP, SIGQUIT, etc. are blocked: postpone the effect and return
Karsten Hopp 7e5694
       * here.  This avoids that a non-reentrant function is interrupted, e.g.,
Karsten Hopp 7e5694
       * free().  Calling free() again may then cause a crash. */
Karsten Hopp 7e5694
*** ../vim-7.1.244/src/version.c	Wed Feb  6 17:33:19 2008
Karsten Hopp 7e5694
--- src/version.c	Sun Feb 10 22:04:09 2008
Karsten Hopp 7e5694
***************
Karsten Hopp 7e5694
*** 668,669 ****
Karsten Hopp 7e5694
--- 668,671 ----
Karsten Hopp 7e5694
  {   /* Add new patch number below this line */
Karsten Hopp 7e5694
+ /**/
Karsten Hopp 7e5694
+     245,
Karsten Hopp 7e5694
  /**/
Karsten Hopp 7e5694
Karsten Hopp 7e5694
-- 
Karsten Hopp 7e5694
Me?  A skeptic?  I trust you have proof.
Karsten Hopp 7e5694
Karsten Hopp 7e5694
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 7e5694
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 7e5694
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 7e5694
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///