[input] try fix handling of modifier+cursor keys

This commit is contained in:
Timothy Stack 2021-10-01 15:58:44 -07:00
parent 3c36869711
commit 2cac26cc00
3 changed files with 17 additions and 3 deletions

View File

@ -86,6 +86,7 @@ void input_dispatcher::new_input(const struct timeval &current_time, int ch)
this->append_to_escape_buffer(ch);
if (strcmp("\x1b[", this->id_escape_buffer) == 0) {
} else if (strcmp("\x1b[<", this->id_escape_buffer) == 0) {
this->id_mouse_handler();
this->id_escape_index = 0;
} else if (this->id_escape_expected_size == -1 ||

View File

@ -83,7 +83,20 @@ public:
map<int, const char *>::const_iterator iter;
const char *retval = nullptr;
if ((iter = this->vem_map.find(ch)) != this->vem_map.end()) {
if ((iter = this->vem_map.find(ch)) == this->vem_map.end()) {
if (ch > KEY_MAX) {
auto name = keyname(ch);
if (name != nullptr) {
auto seq = tigetstr(name);
if (seq != nullptr) {
this->vem_map[ch] = seq;
retval = seq;
}
}
}
} else {
retval = iter->second;
}
@ -151,7 +164,7 @@ private:
};
/** Map of ncurses keycodes to VT52 escape sequences. */
map<int, const char *> vem_map;
mutable map<int, const char *> vem_map;
map<string, const char *> vem_input_map;
};

View File

@ -68,7 +68,7 @@ void xterm_mouse::handle_mouse()
}
buffer[index] = '\0';
if (sscanf(buffer, "<%d;%d;%d", &bstate, &x, &y) == 3) {
if (sscanf(buffer, "%d;%d;%d", &bstate, &x, &y) == 3) {
if (this->xm_behavior) {
this->xm_behavior->mouse_event(bstate, release, x, y);
}