diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-01-21 21:00:56 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2025-01-21 22:21:05 +0800 |
commit | 06a1f82f1cc37225b6acc46e63bd2eb36e034b1a (patch) | |
tree | f02943412f92739d334a66892d03b5f4fa4bd3c8 /src/nvim/terminal.c | |
parent | 44dbfcfba4b09bb0e38f4a3f1960fa256a7bed71 (diff) | |
download | rneovim-06a1f82f1cc37225b6acc46e63bd2eb36e034b1a.tar.gz rneovim-06a1f82f1cc37225b6acc46e63bd2eb36e034b1a.tar.bz2 rneovim-06a1f82f1cc37225b6acc46e63bd2eb36e034b1a.zip |
feat(terminal): forward X1 and X2 mouse events
Ref:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Other-buttons
Diffstat (limited to 'src/nvim/terminal.c')
-rw-r--r-- | src/nvim/terminal.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 197a225209..897c393488 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -792,17 +792,23 @@ static int terminal_execute(VimState *state, int key) case K_LEFTMOUSE: case K_LEFTDRAG: case K_LEFTRELEASE: - case K_MOUSEMOVE: case K_MIDDLEMOUSE: case K_MIDDLEDRAG: case K_MIDDLERELEASE: case K_RIGHTMOUSE: case K_RIGHTDRAG: case K_RIGHTRELEASE: + case K_X1MOUSE: + case K_X1DRAG: + case K_X1RELEASE: + case K_X2MOUSE: + case K_X2DRAG: + case K_X2RELEASE: case K_MOUSEDOWN: case K_MOUSEUP: case K_MOUSELEFT: case K_MOUSERIGHT: + case K_MOUSEMOVE: if (send_mouse_event(s->term, key)) { return 0; } @@ -1804,8 +1810,6 @@ static bool send_mouse_event(Terminal *term, int c) pressed = true; FALLTHROUGH; case K_LEFTRELEASE: button = 1; break; - case K_MOUSEMOVE: - button = 0; break; case K_MIDDLEDRAG: case K_MIDDLEMOUSE: pressed = true; FALLTHROUGH; @@ -1816,6 +1820,16 @@ static bool send_mouse_event(Terminal *term, int c) pressed = true; FALLTHROUGH; case K_RIGHTRELEASE: button = 3; break; + case K_X1DRAG: + case K_X1MOUSE: + pressed = true; FALLTHROUGH; + case K_X1RELEASE: + button = 8; break; + case K_X2DRAG: + case K_X2MOUSE: + pressed = true; FALLTHROUGH; + case K_X2RELEASE: + button = 9; break; case K_MOUSEDOWN: pressed = true; button = 4; break; case K_MOUSEUP: @@ -1824,6 +1838,8 @@ static bool send_mouse_event(Terminal *term, int c) pressed = true; button = 7; break; case K_MOUSERIGHT: pressed = true; button = 6; break; + case K_MOUSEMOVE: + button = 0; break; default: return false; } |