Mercurial > vim
comparison src/getchar.c @ 18394:084b28fb3d22 v8.1.2191
patch 8.1.2191: when using modifyOtherKeys CTRL-X mode may not work
Commit: https://github.com/vim/vim/commit/88d3d09e07dbe0e3ea450bc554e2aadc451450d2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 20 16:00:47 2019 +0200
patch 8.1.2191: when using modifyOtherKeys CTRL-X mode may not work
Problem: When using modifyOtherKeys CTRL-X mode may not work.
Solution: Recognize a control character also in the form with a modifier.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 20 Oct 2019 16:15:03 +0200 |
parents | 9f51d0cef8da |
children | 6208e5c2eee7 |
comparison
equal
deleted
inserted
replaced
18393:8e444b5a5505 | 18394:084b28fb3d22 |
---|---|
2141 map_result_retry, // try to map again | 2141 map_result_retry, // try to map again |
2142 map_result_nomatch // no matching mapping, get char | 2142 map_result_nomatch // no matching mapping, get char |
2143 } map_result_T; | 2143 } map_result_T; |
2144 | 2144 |
2145 /* | 2145 /* |
2146 * Check if the bytes at the start of the typeahead buffer are a character used | |
2147 * in CTRL-X mode. This includes the form with a CTRL modifier. | |
2148 */ | |
2149 static int | |
2150 at_ctrl_x_key(void) | |
2151 { | |
2152 char_u *p = typebuf.tb_buf + typebuf.tb_off; | |
2153 int c = *p; | |
2154 | |
2155 if (typebuf.tb_len > 3 | |
2156 && c == K_SPECIAL | |
2157 && p[1] == KS_MODIFIER | |
2158 && (p[2] & MOD_MASK_CTRL)) | |
2159 c = p[3] & 0x1f; | |
2160 return vim_is_ctrl_x_key(c); | |
2161 } | |
2162 | |
2163 /* | |
2146 * Handle mappings in the typeahead buffer. | 2164 * Handle mappings in the typeahead buffer. |
2147 * - When something was mapped, return map_result_retry for recursive mappings. | 2165 * - When something was mapped, return map_result_retry for recursive mappings. |
2148 * - When nothing mapped and typeahead has a character: return map_result_get. | 2166 * - When nothing mapped and typeahead has a character: return map_result_get. |
2149 * - When there is no match yet, return map_result_nomatch, need to get more | 2167 * - When there is no match yet, return map_result_nomatch, need to get more |
2150 * typeahead. | 2168 * typeahead. |
2191 & (RM_NONE|RM_ABBR)) == 0)) | 2209 & (RM_NONE|RM_ABBR)) == 0)) |
2192 && !(p_paste && (State & (INSERT + CMDLINE))) | 2210 && !(p_paste && (State & (INSERT + CMDLINE))) |
2193 && !(State == HITRETURN && (tb_c1 == CAR || tb_c1 == ' ')) | 2211 && !(State == HITRETURN && (tb_c1 == CAR || tb_c1 == ' ')) |
2194 && State != ASKMORE | 2212 && State != ASKMORE |
2195 && State != CONFIRM | 2213 && State != CONFIRM |
2196 && !((ctrl_x_mode_not_default() && vim_is_ctrl_x_key(tb_c1)) | 2214 && !((ctrl_x_mode_not_default() && at_ctrl_x_key()) |
2197 || ((compl_cont_status & CONT_LOCAL) | 2215 || ((compl_cont_status & CONT_LOCAL) |
2198 && (tb_c1 == Ctrl_N || tb_c1 == Ctrl_P)))) | 2216 && (tb_c1 == Ctrl_N || tb_c1 == Ctrl_P)))) |
2199 { | 2217 { |
2200 #ifdef FEAT_LANGMAP | 2218 #ifdef FEAT_LANGMAP |
2201 if (tb_c1 == K_SPECIAL) | 2219 if (tb_c1 == K_SPECIAL) |