main: Call normal_execute from normal_enter

`normal_prepare` is now called by `normal_check` before returning 1(to
continue).

Also remove `input_{enable,disable}_events` calls from `normal_cmd`, which only
exists now as a compatibility function to run normal commands with keys inserted
into the typeahead buffer(We don't want to process events in these cases
anyway).
This commit is contained in:
Thiago de Arruda
2015-10-05 10:48:03 -03:00
parent e5165bae11
commit 32594a33a3

View File

@@ -463,7 +463,13 @@ void normal_enter(bool cmdwin, bool noexmode)
} else if (check_result == -1) { } else if (check_result == -1) {
continue; continue;
} }
normal_cmd(&state.oa, true);
input_enable_events();
int c = safe_vgetc();
input_disable_events();
if (!normal_execute(&state, c)) {
break;
}
} }
} }
@@ -1271,7 +1277,13 @@ static int normal_check(NormalState *s)
return -1; return -1;
} }
return !s->cmdwin || cmdwin_result == 0; if (s->cmdwin && cmdwin_result != 0) {
// command-line window and cmdwin_result is set
return 0;
}
normal_prepare(s);
return 1;
} }
/* /*
@@ -7589,9 +7601,6 @@ void normal_cmd(oparg_T *oap, bool toplevel)
s.toplevel = toplevel; s.toplevel = toplevel;
s.oa = *oap; s.oa = *oap;
normal_prepare(&s); normal_prepare(&s);
input_enable_events(); (void)normal_execute(&s, safe_vgetc());
int c = safe_vgetc();
input_disable_events();
(void)normal_execute(&s, c);
*oap = s.oa; *oap = s.oa;
} }