summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-30 15:02:22 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-30 15:02:22 +0100
commitee4460306917431d0d17a7cb11c6646f4c6540b6 (patch)
treec3b4843db0824dc67ea9922b85c2b7f07cbf512d /src/getchar.c
parenta5d3590505fc3e1deea990560d472baa563abed7 (diff)
patch 8.2.4848: local completion with mappings and simplification not workingv8.2.4848
Problem: Local completion with mappings and simplification not working. Solution: Fix local completion <C-N>/<C-P> mappings not ignored if keys are not simplified. (closes #10323)
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 2b1bbde4b0..2e5dfb3cef 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -2342,10 +2342,10 @@ typedef enum {
/*
* 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.
+ * in Insert mode completion. This includes the form with a CTRL modifier.
*/
static int
-at_ctrl_x_key(void)
+at_ins_compl_key(void)
{
char_u *p = typebuf.tb_buf + typebuf.tb_off;
int c = *p;
@@ -2355,7 +2355,8 @@ at_ctrl_x_key(void)
&& p[1] == KS_MODIFIER
&& (p[2] & MOD_MASK_CTRL))
c = p[3] & 0x1f;
- return vim_is_ctrl_x_key(c);
+ return (ctrl_x_mode_not_default() && vim_is_ctrl_x_key(c))
+ || (compl_status_local() && (c == Ctrl_N || c == Ctrl_P));
}
/*
@@ -2486,9 +2487,7 @@ handle_mapping(
&& !(State == HITRETURN && (tb_c1 == CAR || tb_c1 == ' '))
&& State != ASKMORE
&& State != CONFIRM
- && !((ctrl_x_mode_not_default() && at_ctrl_x_key())
- || (compl_status_local()
- && (tb_c1 == Ctrl_N || tb_c1 == Ctrl_P))))
+ && !at_ins_compl_key())
{
#ifdef FEAT_GUI
if (gui.in_use && tb_c1 == CSI && typebuf.tb_len >= 2