Stop special input functions "and" & "or" from tearing up multi-char binding

The tentative binding for the upcoming "history-pager-delete" is

    bind -k sdc history-pager-delete or backward-delete-char

When Shift+Delete is pressed while the history pager is active,
"history-pager-delete" succeeds. In this case, the "or" needs to kick the
"backward-delete-char" out of the input queue.
After doing so, it continues reading, but interprets the input as
single-char binding. This breaks when the next key emits a multi-char sequence,
like the arrow keys.

Fix this by reading a full sequence, which means we need to run "read_char()"
instead of "read_ch()" (confusing, right?).

I'm still working on writing a test. Somehow this only reproduces in the
history pager where Shift+Delete followed by down arrow emits "[B" (since
we swallowed the leading escape char).  Confusingly, it doesn't do that in
the commandline or the completion search field.
This commit is contained in:
Johannes Altmanninger 2023-01-29 11:25:12 +01:00
parent 92551e1818
commit 5678602af4

View File

@ -764,7 +764,7 @@ char_event_t inputter_t::read_char(const command_handler_t &command_handler) {
evt = this->readch();
} while (evt.is_readline());
this->push_front(evt);
return readch();
continue;
}
default: {
return evt;