File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111
1212- Fixed issue with the "transparent" CSS value not being transparent when set using python https://github.com/Textualize/textual/pull/5890
1313- Fixed issue with pushing screens when Input has mouse captured https://github.com/Textualize/textual/pull/5900
14+ - Implemented workaround for Ghostty bug which produces negative mouse coordinates https://github.com/Textualize/textual/pull/5926
1415
1516## Changed
1617
Original file line number Diff line number Diff line change 1818# to be unsuccessful?
1919_MAX_SEQUENCE_SEARCH_THRESHOLD = 32
2020
21- _re_mouse_event = re .compile ("^" + re .escape ("\x1b [" ) + r"(<?[\d;]+[mM]|M...)\Z" )
21+ _re_mouse_event = re .compile ("^" + re .escape ("\x1b [" ) + r"(<?[-? \d;]+[mM]|M...)\Z" )
2222_re_terminal_mode_response = re .compile (
2323 "^" + re .escape ("\x1b [" ) + r"\?(?P<mode_id>\d+);(?P<setting_parameter>\d)\$y"
2424)
5050
5151
5252class XTermParser (Parser [Message ]):
53- _re_sgr_mouse = re .compile (r"\x1b\[<(\d+);(\d+);(\d+)([Mm])" )
53+ _re_sgr_mouse = re .compile (r"\x1b\[<(-? \d+);(-? \d+);(-? \d+)([Mm])" )
5454
5555 def __init__ (self , debug : bool = False ) -> None :
5656 self .last_x = 0.0
@@ -78,6 +78,9 @@ def parse_mouse_code(self, code: str) -> Message | None:
7878 buttons = int (_buttons )
7979 x = float (int (_x ) - 1 )
8080 y = float (int (_y ) - 1 )
81+ if x < 0 or y < 0 :
82+ # TODO: Workaround for Ghostty erroneous negative coordinate bug
83+ return None
8184 if (
8285 self .mouse_pixels
8386 and self .terminal_pixel_size is not None
You can’t perform that action at this time.
0 commit comments