revert: "refactor: Remove allow_keys global (#6346)"

This commit is contained in:
zeertzjq
2022-04-27 09:03:09 +08:00
parent d531ef6813
commit f6afc7c324
11 changed files with 42 additions and 0 deletions

View File

@@ -638,6 +638,7 @@ static void normal_get_additional_char(NormalState *s)
int lang; // getting a text character
no_mapping++;
allow_keys++; // no mapping for nchar, but allow key codes
// Don't generate a CursorHold event here, most commands can't handle
// it, e.g., nv_replace(), nv_csearch().
did_cursorhold = true;
@@ -676,6 +677,7 @@ static void normal_get_additional_char(NormalState *s)
if (lang && curbuf->b_p_iminsert == B_IMODE_LMAP) {
// Allow mappings defined with ":lmap".
no_mapping--;
allow_keys--;
if (repl) {
State = LREPLACE;
} else {
@@ -689,6 +691,7 @@ static void normal_get_additional_char(NormalState *s)
if (langmap_active) {
// Undo the decrement done above
no_mapping++;
allow_keys++;
}
State = NORMAL_BUSY;
s->need_flushbuf |= add_to_showcmd(*cp);
@@ -769,6 +772,7 @@ static void normal_get_additional_char(NormalState *s)
no_mapping++;
}
no_mapping--;
allow_keys--;
}
static void normal_invert_horizontal(NormalState *s)
@@ -826,6 +830,7 @@ static bool normal_get_command_count(NormalState *s)
if (s->ctrl_w) {
no_mapping++;
allow_keys++; // no mapping for nchar, but keys
}
no_zero_mapping++; // don't map zero here
@@ -834,6 +839,7 @@ static bool normal_get_command_count(NormalState *s)
no_zero_mapping--;
if (s->ctrl_w) {
no_mapping--;
allow_keys--;
}
s->need_flushbuf |= add_to_showcmd(s->c);
}
@@ -844,9 +850,11 @@ static bool normal_get_command_count(NormalState *s)
s->ca.opcount = s->ca.count0; // remember first count
s->ca.count0 = 0;
no_mapping++;
allow_keys++; // no mapping for nchar, but keys
s->c = plain_vgetc(); // get next character
LANGMAP_ADJUST(s->c, true);
no_mapping--;
allow_keys--;
s->need_flushbuf |= add_to_showcmd(s->c);
return true;
}
@@ -3407,9 +3415,11 @@ static void nv_zet(cmdarg_T *cap)
n = nchar - '0';
for (;;) {
no_mapping++;
allow_keys++; // no mapping for nchar, but allow key codes
nchar = plain_vgetc();
LANGMAP_ADJUST(nchar, true);
no_mapping--;
allow_keys--;
(void)add_to_showcmd(nchar);
if (nchar == K_DEL || nchar == K_KDEL) {
n /= 10;
@@ -3785,9 +3795,11 @@ dozet:
case 'u': // "zug" and "zuw": undo "zg" and "zw"
no_mapping++;
allow_keys++; // no mapping for nchar, but allow key codes
nchar = plain_vgetc();
LANGMAP_ADJUST(nchar, true);
no_mapping--;
allow_keys--;
(void)add_to_showcmd(nchar);
if (vim_strchr((char_u *)"gGwW", nchar) == NULL) {
clearopbeep(cap->oap);