diff options
Diffstat (limited to 'src/nvim/tui/input.c')
-rw-r--r-- | src/nvim/tui/input.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index 7dce8473d5..db1281a0b5 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -480,6 +480,8 @@ static void tk_getkeys(TermInput *input, bool force) } } else if (key.type == TERMKEY_TYPE_OSC) { handle_osc_event(input, &key); + } else if (key.type == TERMKEY_TYPE_MODEREPORT) { + handle_modereport(input, &key); } } @@ -579,9 +581,8 @@ static HandleState handle_bracketed_paste(TermInput *input) } static void handle_osc_event(TermInput *input, const TermKeyKey *key) + FUNC_ATTR_NONNULL_ALL { - assert(input); - const char *str = NULL; if (termkey_interpret_string(input->tk, key, &str) == TERMKEY_RES_KEY) { assert(str != NULL); @@ -601,6 +602,16 @@ static void handle_osc_event(TermInput *input, const TermKeyKey *key) } } +static void handle_modereport(TermInput *input, const TermKeyKey *key) + FUNC_ATTR_NONNULL_ALL +{ + // termkey_interpret_modereport incorrectly sign extends the mode so we parse the response + // ourselves + int mode = (uint8_t)key->code.mouse[1] << 8 | (uint8_t)key->code.mouse[2]; + TerminalModeState value = (uint8_t)key->code.mouse[3]; + tui_dec_report_mode(input->tui_data, (TerminalDecMode)mode, value); +} + static void handle_raw_buffer(TermInput *input, bool force) { HandleState is_paste = kNotApplicable; |