On Wed, Jan 14, 2015 at 12:44:57PM +0100, Bram Moolenaar wrote:
>
> Patch 7.4.569 (after 7.4.468)
> Problem: Having CTRL-C interrupt or not does not check the mode of the
> mapping. (Ingo Karkat)
> Solution: Use a bitmask with the map mode. (Christian Brabandt)
> Files: src/getchar.c, src/structs.h, src/testdir/test_mapping.in,
> src/testdir/test_mapping.ok, src/ui.c, src/globals.h
>
>
> *** ../vim-7.4.568/src/getchar.c 2014-12-14 00:43:50.335749455 +0100
> --- src/getchar.c 2015-01-14 12:13:13.136016098 +0100
> ***************
> *** 3708,3715 ****
> if (!did_it)
> retval = 2; /* no match */
> else if (*keys == Ctrl_C)
> /* If CTRL-C has been unmapped, reuse it for Interrupting. */
> ! mapped_ctrl_c = FALSE;
> goto theend;
> }
>
> --- 3708,3720 ----
> if (!did_it)
> retval = 2; /* no match */
> else if (*keys == Ctrl_C)
> + {
> /* If CTRL-C has been unmapped, reuse it for Interrupting. */
> ! if (map_table == curbuf->b_maphash)
> ! curbuf->b_mapped_ctrl_c &= ~mode;
> ! else
> ! mapped_ctrl_c &= ~mode;
> ! }
> goto theend;
> }
>
> ***************
> *** 3744,3750 ****
>
> /* If CTRL-C has been mapped, don't always use it for Interrupting. */
> if (*keys == Ctrl_C)
> ! mapped_ctrl_c = TRUE;
>
> mp->m_keys = vim_strsave(keys);
> mp->m_str = vim_strsave(rhs);
> --- 3749,3760 ----
>
> /* If CTRL-C has been mapped, don't always use it for Interrupting. */
> if (*keys == Ctrl_C)
> ! {
> ! if (map_table == curbuf->b_maphash)
> ! curbuf->b_mapped_ctrl_c |= mode;
> ! else
> ! mapped_ctrl_c |= mode;
> ! }
>
> mp->m_keys = vim_strsave(keys);
> mp->m_str = vim_strsave(rhs);
> *** ../vim-7.4.568/src/structs.h 2014-09-23 15:45:04.874801055 +0200
> --- src/structs.h 2015-01-14 12:15:33.582480344 +0100
> ***************
> *** 1802,1807 ****
> --- 1802,1808 ----
> cryptstate_T *b_cryptstate; /* Encryption state while reading or
> writing
> * the file. NULL when not using encryption. */
> #endif
> + int b_mapped_ctrl_c; /* modes where CTRL-C is mapped */
>
> }; /* file_buffer */
>
> *** ../vim-7.4.568/src/testdir/test_mapping.in 2014-12-14
> 00:43:50.335749455 +0100
> --- src/testdir/test_mapping.in 2015-01-14 12:11:14.197316987 +0100
> ***************
> *** 8,13 ****
> --- 8,22 ----
> :inoreab чкпр vim
> GAчкпр
>
> + :" mapping of ctrl-c in insert mode
> + :set cpo-=< cpo-=k
> + :inoremap <c-c> <ctrl-c>
> + :cnoremap <c-c> dummy
> + :cunmap <c-c>
> + GA
> + TEST2: CTRL-C | A|
> +
> + :nunmap <c-c>
>
> : " langmap should not get remapped in insert mode
> :inoremap { FAIL_ilangmap
> *** ../vim-7.4.568/src/testdir/test_mapping.ok 2014-12-14
> 00:43:50.335749455 +0100
> --- src/testdir/test_mapping.ok 2015-01-14 12:11:14.197316987 +0100
> ***************
> *** 1,4 ****
> --- 1,6 ----
> test starts here:
> vim
> + TEST2: CTRL-C |<ctrl-c>A|
> +
> +
> +
> *** ../vim-7.4.568/src/ui.c 2014-09-19 13:46:49.550399801 +0200
> --- src/ui.c 2015-01-14 12:18:23.888618642 +0100
> ***************
> *** 180,186 ****
>
> /* ... there is no need for CTRL-C to interrupt something, don't let
> * it set got_int when it was mapped. */
> ! if (mapped_ctrl_c)
> ctrl_c_interrupts = FALSE;
> }
>
> --- 180,186 ----
>
> /* ... there is no need for CTRL-C to interrupt something, don't let
> * it set got_int when it was mapped. */
> ! if ((mapped_ctrl_c | curbuf->b_mapped_ctrl_c) & State)
> ctrl_c_interrupts = FALSE;
> }
>
> *** ../vim-7.4.568/src/globals.h 2014-08-10 13:34:59.056785459 +0200
> --- src/globals.h 2015-01-14 12:13:58.959514980 +0100
> ***************
> *** 958,964 ****
> #ifdef USE_ON_FLY_SCROLL
> EXTERN int dont_scroll INIT(= FALSE);/* don't use scrollbars when TRUE */
> #endif
> ! EXTERN int mapped_ctrl_c INIT(= FALSE); /* CTRL-C is mapped */
> EXTERN int ctrl_c_interrupts INIT(= TRUE); /* CTRL-C sets got_int */
>
> EXTERN cmdmod_T cmdmod; /* Ex command modifiers */
> --- 958,964 ----
> #ifdef USE_ON_FLY_SCROLL
> EXTERN int dont_scroll INIT(= FALSE);/* don't use scrollbars when TRUE */
> #endif
> ! EXTERN int mapped_ctrl_c INIT(= FALSE); /* modes where CTRL-C is mapped */
> EXTERN int ctrl_c_interrupts INIT(= TRUE); /* CTRL-C sets got_int */
>
> EXTERN cmdmod_T cmdmod; /* Ex command modifiers */
> *** ../vim-7.4.568/src/version.c 2015-01-14 11:24:51.851582151 +0100
> --- src/version.c 2015-01-14 12:12:04.728764264 +0100
> ***************
> *** 743,744 ****
> --- 743,746 ----
> { /* Add new patch number below this line */
> + /**/
> + 569,
> /**/
>
> --
> hundred-and-one symptoms of being an internet addict:
> 85. Choice between paying Compuserve bill and paying for kids education
> is a no brainer -- although a bit painful for your kids.
>
> /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
> /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\ an exciting new programming language -- http://www.Zimbu.org ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
>
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups
> "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
tiny build fails with this patch:
gcc -c -I. -Iproto -DHAVE_CONFIG_H -D_FORTIFY_SOURCE=2 -march=x86-64
-mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/getchar.o getchar.c^M
getchar.c: In function 'do_map':^M
getchar.c:3713:29: error: 'buf_T' has no member named 'b_maphash'^M
if (map_table == curbuf->b_maphash)^M
^^M
getchar.c:3753:25: error: 'buf_T' has no member named 'b_maphash'^M
if (map_table == curbuf->b_maphash)^M
^^M
Makefile:2572: recipe for target 'objects/getchar.o' failed^M
make[1]: *** [objects/getchar.o] Error 1^M
--
Ike
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
pgpsgjNuhv11u.pgp
Description: PGP signature
