diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-12-03 19:54:42 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-12-03 19:54:42 +0100 |
commit | 0684e36a7ee0743f2889698fb8e0e14f7acae423 (patch) | |
tree | 7a1f23d46e7e1fa94329d7da561bc4a152b7750f /src/edit.c | |
parent | af0df47a7671a39f2cde950587ba48800188bfb9 (diff) |
patch 8.2.2084: CTRL-V U doesn't work to enter a Unicode characterv8.2.2084
Problem: CTRL-V U doesn't work to enter a Unicode character when
modifyOtherKeys is effective. (Ken Takata)
Solution: Add a flag to get_literal() for the shift key. (closes #7413)
Diffstat (limited to 'src/edit.c')
-rw-r--r-- | src/edit.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/edit.c b/src/edit.c index 8c5cec3a76..a152d84499 100644 --- a/src/edit.c +++ b/src/edit.c @@ -1534,7 +1534,6 @@ ins_ctrl_v(void) { int c; int did_putchar = FALSE; - int prev_mod_mask = mod_mask; // may need to redraw when no more chars available now ins_redraw(FALSE); @@ -1550,7 +1549,9 @@ ins_ctrl_v(void) add_to_showcmd_c(Ctrl_V); #endif - c = get_literal(); + // Do not change any modifyOtherKeys ESC sequence to a normal key for + // CTRL-SHIFT-V. + c = get_literal(mod_mask & MOD_MASK_SHIFT); if (did_putchar) // when the line fits in 'columns' the '^' is at the start of the next // line and will not removed by the redraw @@ -1559,11 +1560,6 @@ ins_ctrl_v(void) clear_showcmd(); #endif - if ((c == ESC || c == CSI) && !(prev_mod_mask & MOD_MASK_SHIFT)) - // Using CTRL-V: Change any modifyOtherKeys ESC sequence to a normal - // key. Don't do this for CTRL-SHIFT-V. - c = decodeModifyOtherKeys(c); - insert_special(c, FALSE, TRUE); #ifdef FEAT_RIGHTLEFT revins_chars++; @@ -1845,9 +1841,11 @@ del_char_after_col(int limit_col UNUSED) * A one, two or three digit decimal number is interpreted as its byte value. * If one or two digits are entered, the next character is given to vungetc(). * For Unicode a character > 255 may be returned. + * If "noReduceKeys" is TRUE do not change any modifyOtherKeys ESC sequence + * into a normal key, return ESC. */ int -get_literal(void) +get_literal(int noReduceKeys) { int cc; int nc; @@ -1878,6 +1876,9 @@ get_literal(void) for (;;) { nc = plain_vgetc(); + if ((nc == ESC || nc == CSI) && !noReduceKeys) + nc = decodeModifyOtherKeys(nc); + #ifdef FEAT_CMDL_INFO if (!(State & CMDLINE) && MB_BYTE2LEN_CHECK(nc) == 1) add_to_showcmd(nc); @@ -3812,8 +3813,7 @@ ins_ctrl_o(void) { if (State & VREPLACE_FLAG) restart_edit = 'V'; - else - if (State & REPLACE_FLAG) + else if (State & REPLACE_FLAG) restart_edit = 'R'; else restart_edit = 'I'; |