aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-11-07 17:53:30 +0800
committerGitHub <noreply@github.com>2024-11-07 17:53:30 +0800
commit5a86360400691e55fae66d60485b61360a1d3d6c (patch)
tree70532d37555cd106ba2155c408b124e285242c69 /src
parent000129201c54d4ba391f7473d0c183f000246c3e (diff)
downloadrneovim-5a86360400691e55fae66d60485b61360a1d3d6c.tar.gz
rneovim-5a86360400691e55fae66d60485b61360a1d3d6c.tar.bz2
rneovim-5a86360400691e55fae66d60485b61360a1d3d6c.zip
test: add test for key following ignored mouse move (#31104)
Diffstat (limited to 'src')
-rw-r--r--src/nvim/os/input.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index f77a25768d..2d17581bac 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -289,8 +289,8 @@ size_t input_enqueue(String keys)
unsigned new_size
= trans_special(&ptr, (size_t)(end - ptr), (char *)buf, FSK_KEYCODE, true, NULL);
- if (new_size) {
- if ((new_size = handle_mouse_event(&ptr, buf, new_size))) {
+ if (new_size > 0) {
+ if ((new_size = handle_mouse_event(&ptr, buf, new_size)) > 0) {
input_enqueue_raw((char *)buf, new_size);
}
continue;
@@ -351,9 +351,9 @@ static uint8_t check_multiclick(int code, int grid, int row, int col, bool *skip
|| code == KE_X1MOUSE || code == KE_X2MOUSE) {
// For click events the number of clicks is updated.
uint64_t mouse_time = os_hrtime(); // time of current mouse click (ns)
- // compute the time elapsed since the previous mouse click and
- // convert p_mouse from ms to ns
+ // Compute the time elapsed since the previous mouse click.
uint64_t timediff = mouse_time - orig_mouse_time;
+ // Convert 'mousetime' from ms to ns.
uint64_t mouset = (uint64_t)p_mouset * 1000000;
if (code == orig_mouse_code
&& no_move
@@ -407,7 +407,7 @@ static unsigned handle_mouse_event(const char **ptr, uint8_t *buf, unsigned bufs
return bufsize;
}
- // a <[COL],[ROW]> sequence can follow and will set the mouse_row/mouse_col
+ // A <[COL],[ROW]> sequence can follow and will set the mouse_row/mouse_col
// global variables. This is ugly but its how the rest of the code expects to
// find mouse coordinates, and it would be too expensive to refactor this
// now.