diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/getchar.c | 14 | ||||
-rw-r--r-- | src/globals.h | 2 | ||||
-rw-r--r-- | src/structs.h | 1 | ||||
-rw-r--r-- | src/testdir/test_mapping.in | 9 | ||||
-rw-r--r-- | src/testdir/test_mapping.ok | 2 | ||||
-rw-r--r-- | src/ui.c | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
7 files changed, 28 insertions, 4 deletions
diff --git a/src/getchar.c b/src/getchar.c index 174cfa892..3ae5f4060 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -3708,8 +3708,13 @@ do_map(maptype, arg, mode, abbrev) 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; + if (map_table == curbuf->b_maphash) + curbuf->b_mapped_ctrl_c &= ~mode; + else + mapped_ctrl_c &= ~mode; + } 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 (*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_str = vim_strsave(rhs); diff --git a/src/globals.h b/src/globals.h index d1fdc33ac..a26a8b535 100644 --- a/src/globals.h +++ b/src/globals.h @@ -958,7 +958,7 @@ EXTERN char_u *exe_name; /* the name of the executable */ #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 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 */ diff --git a/src/structs.h b/src/structs.h index d24175320..7e60a387a 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1802,6 +1802,7 @@ struct file_buffer 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 */ diff --git a/src/testdir/test_mapping.in b/src/testdir/test_mapping.in index 5f895a46f..c957569f4 100644 --- a/src/testdir/test_mapping.in +++ b/src/testdir/test_mapping.in @@ -8,6 +8,15 @@ STARTTEST :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 diff --git a/src/testdir/test_mapping.ok b/src/testdir/test_mapping.ok index 8d9497658..cd0e2e1ca 100644 --- a/src/testdir/test_mapping.ok +++ b/src/testdir/test_mapping.ok @@ -1,4 +1,6 @@ test starts here: vim +TEST2: CTRL-C |<ctrl-c>A| + + + @@ -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 * 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; } diff --git a/src/version.c b/src/version.c index 4f9777ffa..a1b14941f 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 569, +/**/ 568, /**/ 567, |