Remove timeout input events

Now that timeouts are stored in the event queue peeker, we can remove the
notion of timeout events altogether. Instead you may ask for an event with
a timeout, and get back none on timeout. This simplifies how input events
work.
This commit is contained in:
ridiculousfish
2021-04-10 13:40:53 -07:00
parent bd72791340
commit 060ce4f7da
4 changed files with 35 additions and 59 deletions

View File

@@ -229,13 +229,13 @@ static void process_input(bool continuous_mode) {
std::fwprintf(stderr, L"Press a key:\n");
for (;;) {
char_event_t evt{0};
maybe_t<char_event_t> evt{};
if (reader_test_and_clear_interrupted()) {
evt = char_event_t{shell_modes.c_cc[VINTR]};
} else {
evt = queue.readch_timed(true);
evt = queue.readch_timed();
}
if (!evt.is_char()) {
if (!evt || !evt->is_char()) {
output_bind_command(bind_chars);
if (first_char_seen && !continuous_mode) {
return;
@@ -243,7 +243,7 @@ static void process_input(bool continuous_mode) {
continue;
}
wchar_t wc = evt.get_char();
wchar_t wc = evt->get_char();
prev_tstamp = output_elapsed_time(prev_tstamp, first_char_seen);
// Hack for #3189. Do not suggest \c@ as the binding for nul, because a string containing
// nul cannot be passed to builtin_bind since it uses C strings. We'll output the name of