Skip to content

Commit 4394d82

Browse files
committed
fixed button issue
1 parent 4901bba commit 4394d82

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/textual/_xterm_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def parse_mouse_code(self, code: str, sender: MessageTarget) -> events.Event | N
3131
if sgr_match:
3232
_buttons, _x, _y, state = sgr_match.groups()
3333
buttons = int(_buttons)
34-
button = buttons & 3
34+
button = (buttons + 1) & 3
3535
x = int(_x) - 1
3636
y = int(_y) - 1
3737
delta_x = x - self.last_x

src/textual/events.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,8 @@ def __init_subclass__(cls, bubble: bool = False) -> None:
2525

2626

2727
class Null(Event):
28-
def can_batch(self, event: Event) -> bool:
29-
return isinstance(event, Null)
30-
31-
32-
class Repaint(Event):
33-
def can_batch(self, event: Event) -> bool:
34-
return isinstance(event, Repaint)
28+
def can_batch(self, message: Message) -> bool:
29+
return isinstance(message, Null)
3530

3631

3732
class ShutdownRequest(Event):
@@ -96,6 +91,14 @@ class Unmount(Event):
9691
pass
9792

9893

94+
class Show(Event):
95+
"""Widget has become visible."""
96+
97+
98+
class Hide(Event):
99+
"""Widget has been hidden."""
100+
101+
99102
class InputEvent(Event, bubble=True):
100103
pass
101104

0 commit comments

Comments
 (0)