diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 17:07:12 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 17:07:12 +0300 |
| commit | 2d02d39d2cd32e9eb559638865d2746f02c08556 (patch) | |
| tree | a54055b20284f5e7c2e4f66cad3d3ec4e217eebb /src/input.c | |
| parent | 1e69599900a753e2d7275d7ba714202b7d9c843e (diff) | |
Fix extra mouse button encoding collision with Alt bit and document API gaps
- Encode buttons 8 through 11 (EXTRA_1..4) with offset 128 (128..131)
per xterm mouse tracking, resolving collisions with the Alt modifier bit (8)
- Drop EXTRA_5 from enum term_mouse_button since xterm mouse tracking defines
four extra buttons (8 to 11) and codes beyond 131 collide with modifier bits
- Replace literal 3 with TERM_MOUSE_BUTTON_NONE for hover motion check in mode 1002
- Document button field semantics in struct term_mouse_event for press, release,
motion, and scroll events
- Document OSC 52 target buffer selections ("c", "p", "q", "s", "0".."7") in term.h
- Add unit tests for extra button encoding, SGR release, hover motion suppression
in mode 1002, and non-collision with Alt modifiers
Diffstat (limited to 'src/input.c')
| -rw-r--r-- | src/input.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/input.c b/src/input.c index 63313be..5625825 100644 --- a/src/input.c +++ b/src/input.c @@ -604,14 +604,14 @@ struct term_input_result term_input_encode_mouse(const struct term_mouse_event * return out; } if (ev->kind == TERM_MOUSE_MOTION && (m->mouse == TERM_MOUSE_NORMAL || - (m->mouse == TERM_MOUSE_BUTTON && ev->button == 3))) { + (m->mouse == TERM_MOUSE_BUTTON && ev->button == TERM_MOUSE_BUTTON_NONE))) { return out; } int button; if (ev->button >= TERM_MOUSE_BUTTON_PRIMARY && ev->button <= TERM_MOUSE_BUTTON_NONE) button = ev->button; - else if (ev->button >= TERM_MOUSE_BUTTON_EXTRA_1 && ev->button <= TERM_MOUSE_BUTTON_EXTRA_5) - button = 8 + ev->button - TERM_MOUSE_BUTTON_EXTRA_1; + else if (ev->button >= TERM_MOUSE_BUTTON_EXTRA_1 && ev->button <= TERM_MOUSE_BUTTON_EXTRA_4) + button = 128 + ev->button - TERM_MOUSE_BUTTON_EXTRA_1; else if (ev->button >= TERM_MOUSE_WHEEL_UP && ev->button <= TERM_MOUSE_WHEEL_RIGHT) button = 64 + ev->button - TERM_MOUSE_WHEEL_UP; else { |
