Skip to content

Commit 342f098

Browse files
committed
Add tests for selection extension by right click
1 parent 9c19e88 commit 342f098

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

kitty_tests/mouse.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
from functools import partial
66

77
from kitty.fast_data_types import (
8-
GLFW_MOD_ALT, GLFW_MOD_CONTROL, GLFW_MOUSE_BUTTON_LEFT, create_mock_window,
8+
GLFW_MOD_ALT, GLFW_MOD_CONTROL, GLFW_MOUSE_BUTTON_LEFT,
9+
GLFW_MOUSE_BUTTON_RIGHT, create_mock_window,
910
send_mock_mouse_event_to_window
1011
)
1112

@@ -55,12 +56,12 @@ def init():
5556
s.draw('fghij')
5657
s.draw('klmno')
5758

58-
def press(x=0, y=0, modifiers=0):
59-
ev(GLFW_MOUSE_BUTTON_LEFT, x=x, y=y, modifiers=modifiers)
59+
def press(x=0, y=0, modifiers=0, button=GLFW_MOUSE_BUTTON_LEFT):
60+
ev(button, x=x, y=y, modifiers=modifiers)
6061

61-
def release(x=0, y=0):
62+
def release(x=0, y=0, button=GLFW_MOUSE_BUTTON_LEFT):
6263
ev(
63-
GLFW_MOUSE_BUTTON_LEFT,
64+
button,
6465
x=x,
6566
y=y,
6667
is_release=True,
@@ -200,3 +201,16 @@ def scroll(x=0, y=0, up=True):
200201
scroll(x=2.6, up=False)
201202
self.ae(sel(), '3')
202203
release()
204+
205+
# extending selections
206+
init()
207+
press()
208+
move(x=3.6, q='1234')
209+
release(x=3.6)
210+
self.ae(sel(), '1234')
211+
press(x=1, y=1, button=GLFW_MOUSE_BUTTON_RIGHT)
212+
self.ae(sel(), '123456')
213+
move(x=2, y=1)
214+
self.ae(sel(), '1234567')
215+
release(x=3, y=1, button=GLFW_MOUSE_BUTTON_RIGHT)
216+
self.ae(sel(), '12345678')

0 commit comments

Comments
 (0)