Skip to content

Commit 88d3d09

Browse files
committed
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.
1 parent 83e9a1c commit 88d3d09

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/getchar.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2142,6 +2142,24 @@ typedef enum {
21422142
map_result_nomatch // no matching mapping, get char
21432143
} map_result_T;
21442144

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+
21452163
/*
21462164
* Handle mappings in the typeahead buffer.
21472165
* - When something was mapped, return map_result_retry for recursive mappings.
@@ -2193,7 +2211,7 @@ handle_mapping(
21932211
&& !(State == HITRETURN && (tb_c1 == CAR || tb_c1 == ' '))
21942212
&& State != ASKMORE
21952213
&& 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())
21972215
|| ((compl_cont_status & CONT_LOCAL)
21982216
&& (tb_c1 == Ctrl_N || tb_c1 == Ctrl_P))))
21992217
{

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
2191,
744746
/**/
745747
2190,
746748
/**/

0 commit comments

Comments
 (0)