]> granicus.if.org Git - vim/commitdiff
patch 8.1.2191: when using modifyOtherKeys CTRL-X mode may not work v8.1.2191
authorBram Moolenaar <Bram@vim.org>
Sun, 20 Oct 2019 14:00:47 +0000 (16:00 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 20 Oct 2019 14:00:47 +0000 (16:00 +0200)
Problem:    When using modifyOtherKeys CTRL-X mode may not work.
Solution:   Recognize a control character also in the form with a modifier.

src/getchar.c
src/version.c

index 03a67be34ad1f16eb09be840b8f73f729bfeea10..f9bfab8297007728f2f7f28c31bcf0029cf33538 100644 (file)
@@ -2142,6 +2142,24 @@ typedef enum {
     map_result_nomatch  // no matching mapping, get char
 } map_result_T;
 
+/*
+ * Check if the bytes at the start of the typeahead buffer are a character used
+ * in CTRL-X mode.  This includes the form with a CTRL modifier.
+ */
+    static int
+at_ctrl_x_key(void)
+{
+    char_u  *p = typebuf.tb_buf + typebuf.tb_off;
+    int            c = *p;
+
+    if (typebuf.tb_len > 3
+           && c == K_SPECIAL
+           && p[1] == KS_MODIFIER
+           && (p[2] & MOD_MASK_CTRL))
+       c = p[3] & 0x1f;
+    return vim_is_ctrl_x_key(c);
+}
+
 /*
  * Handle mappings in the typeahead buffer.
  * - When something was mapped, return map_result_retry for recursive mappings.
@@ -2193,7 +2211,7 @@ handle_mapping(
            && !(State == HITRETURN && (tb_c1 == CAR || tb_c1 == ' '))
            && State != ASKMORE
            && State != CONFIRM
-           && !((ctrl_x_mode_not_default() && vim_is_ctrl_x_key(tb_c1))
+           && !((ctrl_x_mode_not_default() && at_ctrl_x_key())
                    || ((compl_cont_status & CONT_LOCAL)
                        && (tb_c1 == Ctrl_N || tb_c1 == Ctrl_P))))
     {
index caf8ccf2bac9c57b31bc539c30d4f206ac66a98c..c9c0943e1435482aa604e8a835cbc30cf2534cb8 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2191,
 /**/
     2190,
 /**/