0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00

updated for version 7.4.569

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)
This commit is contained in:
Bram Moolenaar 2015-01-14 12:44:41 +01:00
parent 8be6388b76
commit 651863c94a
7 changed files with 28 additions and 4 deletions

View File

@ -3708,8 +3708,13 @@ do_map(maptype, arg, mode, abbrev)
if (!did_it) if (!did_it)
retval = 2; /* no match */ retval = 2; /* no match */
else if (*keys == Ctrl_C) else if (*keys == Ctrl_C)
{
/* If CTRL-C has been unmapped, reuse it for Interrupting. */ /* If CTRL-C has been unmapped, reuse it for Interrupting. */
mapped_ctrl_c = FALSE; if (map_table == curbuf->b_maphash)
curbuf->b_mapped_ctrl_c &= ~mode;
else
mapped_ctrl_c &= ~mode;
}
goto theend; goto theend;
} }
@ -3744,7 +3749,12 @@ do_map(maptype, arg, mode, abbrev)
/* If CTRL-C has been mapped, don't always use it for Interrupting. */ /* If CTRL-C has been mapped, don't always use it for Interrupting. */
if (*keys == Ctrl_C) if (*keys == Ctrl_C)
mapped_ctrl_c = TRUE; {
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_keys = vim_strsave(keys);
mp->m_str = vim_strsave(rhs); mp->m_str = vim_strsave(rhs);

View File

@ -958,7 +958,7 @@ EXTERN char_u *exe_name; /* the name of the executable */
#ifdef USE_ON_FLY_SCROLL #ifdef USE_ON_FLY_SCROLL
EXTERN int dont_scroll INIT(= FALSE);/* don't use scrollbars when TRUE */ EXTERN int dont_scroll INIT(= FALSE);/* don't use scrollbars when TRUE */
#endif #endif
EXTERN int mapped_ctrl_c INIT(= FALSE); /* CTRL-C is mapped */ 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 int ctrl_c_interrupts INIT(= TRUE); /* CTRL-C sets got_int */
EXTERN cmdmod_T cmdmod; /* Ex command modifiers */ EXTERN cmdmod_T cmdmod; /* Ex command modifiers */

View File

@ -1802,6 +1802,7 @@ struct file_buffer
cryptstate_T *b_cryptstate; /* Encryption state while reading or writing cryptstate_T *b_cryptstate; /* Encryption state while reading or writing
* the file. NULL when not using encryption. */ * the file. NULL when not using encryption. */
#endif #endif
int b_mapped_ctrl_c; /* modes where CTRL-C is mapped */
}; /* file_buffer */ }; /* file_buffer */

View File

@ -8,6 +8,15 @@ STARTTEST
:inoreab чкпр vim :inoreab чкпр vim
GAчкпр 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 : " langmap should not get remapped in insert mode
:inoremap { FAIL_ilangmap :inoremap { FAIL_ilangmap

View File

@ -1,4 +1,6 @@
test starts here: test starts here:
vim vim
TEST2: CTRL-C |<ctrl-c>A|
+ +
+ +

View File

@ -180,7 +180,7 @@ ui_inchar(buf, maxlen, wtime, tb_change_cnt)
/* ... there is no need for CTRL-C to interrupt something, don't let /* ... there is no need for CTRL-C to interrupt something, don't let
* it set got_int when it was mapped. */ * it set got_int when it was mapped. */
if (mapped_ctrl_c) if ((mapped_ctrl_c | curbuf->b_mapped_ctrl_c) & State)
ctrl_c_interrupts = FALSE; ctrl_c_interrupts = FALSE;
} }

View File

@ -741,6 +741,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
569,
/**/ /**/
568, 568,
/**/ /**/