Karsten Hopp c7dc68
To: vim_dev@googlegroups.com
Karsten Hopp c7dc68
Subject: Patch 7.4.569
Karsten Hopp c7dc68
Fcc: outbox
Karsten Hopp c7dc68
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp c7dc68
Mime-Version: 1.0
Karsten Hopp c7dc68
Content-Type: text/plain; charset=UTF-8
Karsten Hopp c7dc68
Content-Transfer-Encoding: 8bit
Karsten Hopp c7dc68
------------
Karsten Hopp c7dc68
Karsten Hopp c7dc68
Patch 7.4.569 (after 7.4.468)
Karsten Hopp c7dc68
Problem:    Having CTRL-C interrupt or not does not check the mode of the
Karsten Hopp c7dc68
	    mapping. (Ingo Karkat)
Karsten Hopp c7dc68
Solution:   Use a bitmask with the map mode. (Christian Brabandt)
Karsten Hopp c7dc68
Files:	    src/getchar.c, src/structs.h, src/testdir/test_mapping.in,
Karsten Hopp c7dc68
	    src/testdir/test_mapping.ok, src/ui.c, src/globals.h
Karsten Hopp c7dc68
Karsten Hopp c7dc68
Karsten Hopp c7dc68
*** ../vim-7.4.568/src/getchar.c	2014-12-14 00:43:50.335749455 +0100
Karsten Hopp c7dc68
--- src/getchar.c	2015-01-14 12:13:13.136016098 +0100
Karsten Hopp c7dc68
***************
Karsten Hopp c7dc68
*** 3708,3715 ****
Karsten Hopp c7dc68
  	if (!did_it)
Karsten Hopp c7dc68
  	    retval = 2;			    /* no match */
Karsten Hopp c7dc68
  	else if (*keys == Ctrl_C)
Karsten Hopp c7dc68
  	    /* If CTRL-C has been unmapped, reuse it for Interrupting. */
Karsten Hopp c7dc68
! 	    mapped_ctrl_c = FALSE;
Karsten Hopp c7dc68
  	goto theend;
Karsten Hopp c7dc68
      }
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
--- 3708,3720 ----
Karsten Hopp c7dc68
  	if (!did_it)
Karsten Hopp c7dc68
  	    retval = 2;			    /* no match */
Karsten Hopp c7dc68
  	else if (*keys == Ctrl_C)
Karsten Hopp c7dc68
+ 	{
Karsten Hopp c7dc68
  	    /* If CTRL-C has been unmapped, reuse it for Interrupting. */
Karsten Hopp c7dc68
! 	    if (map_table == curbuf->b_maphash)
Karsten Hopp c7dc68
! 		curbuf->b_mapped_ctrl_c &= ~mode;
Karsten Hopp c7dc68
! 	    else
Karsten Hopp c7dc68
! 		mapped_ctrl_c &= ~mode;
Karsten Hopp c7dc68
! 	}
Karsten Hopp c7dc68
  	goto theend;
Karsten Hopp c7dc68
      }
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
***************
Karsten Hopp c7dc68
*** 3744,3750 ****
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
      /* If CTRL-C has been mapped, don't always use it for Interrupting. */
Karsten Hopp c7dc68
      if (*keys == Ctrl_C)
Karsten Hopp c7dc68
! 	mapped_ctrl_c = TRUE;
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
      mp->m_keys = vim_strsave(keys);
Karsten Hopp c7dc68
      mp->m_str = vim_strsave(rhs);
Karsten Hopp c7dc68
--- 3749,3760 ----
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
      /* If CTRL-C has been mapped, don't always use it for Interrupting. */
Karsten Hopp c7dc68
      if (*keys == Ctrl_C)
Karsten Hopp c7dc68
!     {
Karsten Hopp c7dc68
! 	if (map_table == curbuf->b_maphash)
Karsten Hopp c7dc68
! 	    curbuf->b_mapped_ctrl_c |= mode;
Karsten Hopp c7dc68
! 	else
Karsten Hopp c7dc68
! 	    mapped_ctrl_c |= mode;
Karsten Hopp c7dc68
!     }
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
      mp->m_keys = vim_strsave(keys);
Karsten Hopp c7dc68
      mp->m_str = vim_strsave(rhs);
Karsten Hopp c7dc68
*** ../vim-7.4.568/src/structs.h	2014-09-23 15:45:04.874801055 +0200
Karsten Hopp c7dc68
--- src/structs.h	2015-01-14 12:15:33.582480344 +0100
Karsten Hopp c7dc68
***************
Karsten Hopp c7dc68
*** 1802,1807 ****
Karsten Hopp c7dc68
--- 1802,1808 ----
Karsten Hopp c7dc68
      cryptstate_T *b_cryptstate;	/* Encryption state while reading or writing
Karsten Hopp c7dc68
  				 * the file. NULL when not using encryption. */
Karsten Hopp c7dc68
  #endif
Karsten Hopp c7dc68
+     int		b_mapped_ctrl_c; /* modes where CTRL-C is mapped */
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
  }; /* file_buffer */
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
*** ../vim-7.4.568/src/testdir/test_mapping.in	2014-12-14 00:43:50.335749455 +0100
Karsten Hopp c7dc68
--- src/testdir/test_mapping.in	2015-01-14 12:11:14.197316987 +0100
Karsten Hopp c7dc68
***************
Karsten Hopp c7dc68
*** 8,13 ****
Karsten Hopp c7dc68
--- 8,22 ----
Karsten Hopp c7dc68
  :inoreab чкпр   vim
Karsten Hopp c7dc68
  GAчкпр 
Karsten Hopp c7dc68
  ?
Karsten Hopp c7dc68
+ :" mapping of ctrl-c in insert mode
Karsten Hopp c7dc68
+ :set cpo-=< cpo-=k
Karsten Hopp c7dc68
+ :inoremap <c-c> <ctrl-c>
Karsten Hopp c7dc68
+ :cnoremap <c-c> dummy
Karsten Hopp c7dc68
+ :cunmap <c-c>
Karsten Hopp c7dc68
+ GA
Karsten Hopp c7dc68
+ TEST2: CTRL-C |?A|
Karsten Hopp c7dc68
+ ?
Karsten Hopp c7dc68
+ :nunmap <c-c>
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
  : " langmap should not get remapped in insert mode
Karsten Hopp c7dc68
  :inoremap { FAIL_ilangmap
Karsten Hopp c7dc68
*** ../vim-7.4.568/src/testdir/test_mapping.ok	2014-12-14 00:43:50.335749455 +0100
Karsten Hopp c7dc68
--- src/testdir/test_mapping.ok	2015-01-14 12:11:14.197316987 +0100
Karsten Hopp c7dc68
***************
Karsten Hopp c7dc68
*** 1,4 ****
Karsten Hopp c7dc68
--- 1,6 ----
Karsten Hopp c7dc68
  test starts here:
Karsten Hopp c7dc68
  vim
Karsten Hopp c7dc68
+ TEST2: CTRL-C |<ctrl-c>A|
Karsten Hopp c7dc68
+ 
Karsten Hopp c7dc68
  +
Karsten Hopp c7dc68
  +
Karsten Hopp c7dc68
*** ../vim-7.4.568/src/ui.c	2014-09-19 13:46:49.550399801 +0200
Karsten Hopp c7dc68
--- src/ui.c	2015-01-14 12:18:23.888618642 +0100
Karsten Hopp c7dc68
***************
Karsten Hopp c7dc68
*** 180,186 ****
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
  	/* ... there is no need for CTRL-C to interrupt something, don't let
Karsten Hopp c7dc68
  	 * it set got_int when it was mapped. */
Karsten Hopp c7dc68
! 	if (mapped_ctrl_c)
Karsten Hopp c7dc68
  	    ctrl_c_interrupts = FALSE;
Karsten Hopp c7dc68
      }
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
--- 180,186 ----
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
  	/* ... there is no need for CTRL-C to interrupt something, don't let
Karsten Hopp c7dc68
  	 * it set got_int when it was mapped. */
Karsten Hopp c7dc68
! 	if ((mapped_ctrl_c | curbuf->b_mapped_ctrl_c) & State)
Karsten Hopp c7dc68
  	    ctrl_c_interrupts = FALSE;
Karsten Hopp c7dc68
      }
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
*** ../vim-7.4.568/src/globals.h	2014-08-10 13:34:59.056785459 +0200
Karsten Hopp c7dc68
--- src/globals.h	2015-01-14 12:13:58.959514980 +0100
Karsten Hopp c7dc68
***************
Karsten Hopp c7dc68
*** 958,964 ****
Karsten Hopp c7dc68
  #ifdef USE_ON_FLY_SCROLL
Karsten Hopp c7dc68
  EXTERN int	dont_scroll INIT(= FALSE);/* don't use scrollbars when TRUE */
Karsten Hopp c7dc68
  #endif
Karsten Hopp c7dc68
! EXTERN int	mapped_ctrl_c INIT(= FALSE); /* CTRL-C is mapped */
Karsten Hopp c7dc68
  EXTERN int	ctrl_c_interrupts INIT(= TRUE);	/* CTRL-C sets got_int */
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
  EXTERN cmdmod_T	cmdmod;			/* Ex command modifiers */
Karsten Hopp c7dc68
--- 958,964 ----
Karsten Hopp c7dc68
  #ifdef USE_ON_FLY_SCROLL
Karsten Hopp c7dc68
  EXTERN int	dont_scroll INIT(= FALSE);/* don't use scrollbars when TRUE */
Karsten Hopp c7dc68
  #endif
Karsten Hopp c7dc68
! EXTERN int	mapped_ctrl_c INIT(= FALSE); /* modes where CTRL-C is mapped */
Karsten Hopp c7dc68
  EXTERN int	ctrl_c_interrupts INIT(= TRUE);	/* CTRL-C sets got_int */
Karsten Hopp c7dc68
  
Karsten Hopp c7dc68
  EXTERN cmdmod_T	cmdmod;			/* Ex command modifiers */
Karsten Hopp c7dc68
*** ../vim-7.4.568/src/version.c	2015-01-14 11:24:51.851582151 +0100
Karsten Hopp c7dc68
--- src/version.c	2015-01-14 12:12:04.728764264 +0100
Karsten Hopp c7dc68
***************
Karsten Hopp c7dc68
*** 743,744 ****
Karsten Hopp c7dc68
--- 743,746 ----
Karsten Hopp c7dc68
  {   /* Add new patch number below this line */
Karsten Hopp c7dc68
+ /**/
Karsten Hopp c7dc68
+     569,
Karsten Hopp c7dc68
  /**/
Karsten Hopp c7dc68
Karsten Hopp c7dc68
-- 
Karsten Hopp c7dc68
hundred-and-one symptoms of being an internet addict:
Karsten Hopp c7dc68
85. Choice between paying Compuserve bill and paying for kids education
Karsten Hopp c7dc68
    is a no brainer -- although a bit painful for your kids.
Karsten Hopp c7dc68
Karsten Hopp c7dc68
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp c7dc68
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp c7dc68
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp c7dc68
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///