Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0255602

Browse files
committed
feat(tui): recognize sidescroll events
I can't find this documented anywhere, but both xterm and kitty send aCSI < 66 ; x ; y M sequence for scrolling to the left, and send aCSI < 67 ; x ; y M sequence for scrolling to the right.
1 parent92bc11a commit0255602

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

‎src/nvim/tui/input.c‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,14 @@ static void forward_mouse_event(TermInput *input, TermKeyKey *key)
398398
button=last_pressed_button;
399399
}
400400

401+
if (ev==TERMKEY_MOUSE_UNKNOWN&& !(key->code.mouse[0]&0x20)) {
402+
intcode=key->code.mouse[0]& ~0x3c;
403+
if (code==66||code==67) {
404+
ev=TERMKEY_MOUSE_PRESS;
405+
button=code-60;
406+
}
407+
}
408+
401409
if (button==0|| (ev!=TERMKEY_MOUSE_PRESS&&ev!=TERMKEY_MOUSE_DRAG
402410
&&ev!=TERMKEY_MOUSE_RELEASE)) {
403411
return;
@@ -431,8 +439,11 @@ static void forward_mouse_event(TermInput *input, TermKeyKey *key)
431439
if (button==4) {
432440
len+= (size_t)snprintf(buf+len,sizeof(buf)-len,"ScrollWheelUp");
433441
}elseif (button==5) {
434-
len+= (size_t)snprintf(buf+len,sizeof(buf)-len,
435-
"ScrollWheelDown");
442+
len+= (size_t)snprintf(buf+len,sizeof(buf)-len,"ScrollWheelDown");
443+
}elseif (button==6) {
444+
len+= (size_t)snprintf(buf+len,sizeof(buf)-len,"ScrollWheelLeft");
445+
}elseif (button==7) {
446+
len+= (size_t)snprintf(buf+len,sizeof(buf)-len,"ScrollWheelRight");
436447
}else {
437448
len+= (size_t)snprintf(buf+len,sizeof(buf)-len,"Mouse");
438449
last_pressed_button=button;

‎test/functional/terminal/tui_spec.lua‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ describe('TUI', function()
297297
]],attrs)
298298
end)
299299

300+
it('accepts mouse wheel events',function()
301+
end)
302+
300303
it('accepts keypad keys from kitty keyboard protocol #19180',function()
301304
feed_data('i')
302305
feed_data(funcs.nr2char(57399))-- KP_0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp