Skip to content

Commit

Permalink
K_EVENT and focus(lost|gained) should not finish operator
Browse files Browse the repository at this point in the history
reference neovim#5398 and neovim#6166
  • Loading branch information
hardenedapple committed Sep 2, 2017
1 parent 3fc3620 commit 493af8d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/nvim/normal.c
Expand Up @@ -134,6 +134,7 @@ typedef void (*nv_func_T)(cmdarg_T *cap);
#define NV_RL 0x80 /* 'rightleft' modifies command */
#define NV_KEEPREG 0x100 /* don't clear regname */
#define NV_NCW 0x200 /* not allowed in command-line window */
#define NV_NOFINISH 0x400 /* does not finish a pending operator */

/*
* Generally speaking, every Normal mode command should either clear any
Expand Down Expand Up @@ -344,9 +345,9 @@ static const struct nv_cmd {
{ K_SELECT, nv_select, 0, 0 },
{ K_F8, farsi_f8, 0, 0 },
{ K_F9, farsi_f9, 0, 0 },
{ K_EVENT, nv_event, NV_KEEPREG, 0 },
{ K_FOCUSGAINED, nv_focusgained, NV_KEEPREG, 0 },
{ K_FOCUSLOST, nv_focuslost, NV_KEEPREG, 0 },
{ K_EVENT, nv_event, NV_KEEPREG|NV_NOFINISH, 0 },
{ K_FOCUSGAINED, nv_focusgained, NV_KEEPREG|NV_NOFINISH, 0 },
{ K_FOCUSLOST, nv_focuslost, NV_KEEPREG|NV_NOFINISH, 0 },
};

/* Number of commands in nv_cmds[]. */
Expand Down Expand Up @@ -882,7 +883,8 @@ static void normal_finish_command(NormalState *s)
}

// If an operation is pending, handle it...
do_pending_operator(&s->ca, s->old_col, false);
if (!(nv_cmds[s->idx].cmd_flags & NV_NOFINISH))
do_pending_operator(&s->ca, s->old_col, false);

// Wait for a moment when a message is displayed that will be overwritten
// by the mode message.
Expand Down

0 comments on commit 493af8d

Please sign in to comment.