aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-05-27 12:01:35 +0200
committerGitHub <noreply@github.com>2019-05-27 12:01:35 +0200
commit69b3d5acd375e36a06474c6ebd2622cb0c2fcca5 (patch)
treef34ba1b9e0e138f86666e77280da66f6ca0687e3 /src/nvim/normal.c
parentfb4d5a184678ab231da20ef559c8e423dfa54d6e (diff)
parent3c3b7844b95879bcfd86677df4cfac3edb0fb132 (diff)
downloadrneovim-69b3d5acd375e36a06474c6ebd2622cb0c2fcca5.tar.gz
rneovim-69b3d5acd375e36a06474c6ebd2622cb0c2fcca5.tar.bz2
rneovim-69b3d5acd375e36a06474c6ebd2622cb0c2fcca5.zip
Merge #10068 from janlazo/vim-8.1.0020
vim-patch:8.1.{20,995,1077}
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index d6e78d9ce4..db2da6a807 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -541,27 +541,29 @@ static bool normal_need_additional_char(NormalState *s)
int flags = nv_cmds[s->idx].cmd_flags;
bool pending_op = s->oa.op_type != OP_NOP;
int cmdchar = s->ca.cmdchar;
- return
- // without NV_NCH we never need to check for an additional char
- flags & NV_NCH && (
- // NV_NCH_NOP is set and no operator is pending, get a second char
- ((flags & NV_NCH_NOP) == NV_NCH_NOP && !pending_op)
- // NV_NCH_ALW is set, always get a second char
- || (flags & NV_NCH_ALW) == NV_NCH_ALW
- // 'q' without a pending operator, recording or executing a register,
- // needs to be followed by a second char, examples:
- // - qc => record using register c
- // - q: => open command-line window
- || (cmdchar == 'q' && !pending_op && !Recording && !Exec_reg)
- // 'a' or 'i' after an operator is a text object, examples:
- // - ciw => change inside word
- // - da( => delete parenthesis and everything inside.
- // Also, don't do anything when these keys are received in visual mode
- // so just get another char.
- //
- // TODO(tarruda): Visual state needs to be refactored into a
- // separate state that "inherits" from normal state.
- || ((cmdchar == 'a' || cmdchar == 'i') && (pending_op || VIsual_active)));
+ // without NV_NCH we never need to check for an additional char
+ return flags & NV_NCH && (
+ // NV_NCH_NOP is set and no operator is pending, get a second char
+ ((flags & NV_NCH_NOP) == NV_NCH_NOP && !pending_op)
+ // NV_NCH_ALW is set, always get a second char
+ || (flags & NV_NCH_ALW) == NV_NCH_ALW
+ // 'q' without a pending operator, recording or executing a register,
+ // needs to be followed by a second char, examples:
+ // - qc => record using register c
+ // - q: => open command-line window
+ || (cmdchar == 'q'
+ && !pending_op
+ && reg_recording == 0
+ && reg_executing == 0)
+ // 'a' or 'i' after an operator is a text object, examples:
+ // - ciw => change inside word
+ // - da( => delete parenthesis and everything inside.
+ // Also, don't do anything when these keys are received in visual mode
+ // so just get another char.
+ //
+ // TODO(tarruda): Visual state needs to be refactored into a
+ // separate state that "inherits" from normal state.
+ || ((cmdchar == 'a' || cmdchar == 'i') && (pending_op || VIsual_active)));
}
static bool normal_need_redraw_mode_message(NormalState *s)
@@ -7686,7 +7688,7 @@ static void nv_record(cmdarg_T *cap)
} else {
// (stop) recording into a named register, unless executing a
// register.
- if (!Exec_reg && do_record(cap->nchar) == FAIL) {
+ if (reg_executing == 0 && do_record(cap->nchar) == FAIL) {
clearopbeep(cap->oap);
}
}