aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/tui/input.c
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2023-11-17 12:15:16 -0600
committerGregory Anders <greg@gpanders.com>2023-11-17 13:37:33 -0600
commite80b83bf567523d325c78c71fed04bec9492e07d (patch)
treebc83d32bdf76d79b4da97144e933411e3361e48e /src/nvim/tui/input.c
parent89dd939c154d11a7bbb41ac5defb87b13ca10b60 (diff)
downloadrneovim-e80b83bf567523d325c78c71fed04bec9492e07d.tar.gz
rneovim-e80b83bf567523d325c78c71fed04bec9492e07d.tar.bz2
rneovim-e80b83bf567523d325c78c71fed04bec9492e07d.zip
refactor(tui): use termkey_interpret_modereport
The sign extension issue has been fixed upstream, so we no longer need to use our own workaround.
Diffstat (limited to 'src/nvim/tui/input.c')
-rw-r--r--src/nvim/tui/input.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c
index 03f22745bf..6b9361848a 100644
--- a/src/nvim/tui/input.c
+++ b/src/nvim/tui/input.c
@@ -586,11 +586,13 @@ static void handle_term_response(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);
+ int initial;
+ int mode;
+ int value;
+ if (termkey_interpret_modereport(input->tk, key, &initial, &mode, &value) == TERMKEY_RES_KEY) {
+ (void)initial; // Unused
+ tui_handle_term_mode(input->tui_data, (TermMode)mode, (TermModeState)value);
+ }
}
/// Handle a CSI sequence from the terminal that is unrecognized by libtermkey.