Recode incoming text on Windows before input event processing

See #3178.
This commit is contained in:
Dave Pearson 2023-09-13 09:44:43 +01:00
parent 0a14bf0549
commit b6bbcb15f9
No known key found for this signature in database
GPG key ID: B413E0EF113D4ABF
2 changed files with 7 additions and 1 deletions

View file

@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fixed a crash when removing an option from an `OptionList` while the mouse is hovering over the last option https://github.com/Textualize/textual/issues/3270 - Fixed a crash when removing an option from an `OptionList` while the mouse is hovering over the last option https://github.com/Textualize/textual/issues/3270
- Fixed a crash in `MarkdownViewer` when clicking on a link that contains an anchor https://github.com/Textualize/textual/issues/3094 - Fixed a crash in `MarkdownViewer` when clicking on a link that contains an anchor https://github.com/Textualize/textual/issues/3094
- Fixed application freeze when pasting an emoji into an application on Windows https://github.com/Textualize/textual/issues/3178
### Changed ### Changed

View file

@ -278,7 +278,12 @@ class EventMonitor(threading.Thread):
if keys: if keys:
# Process keys # Process keys
for event in parser.feed("".join(keys)): #
# https://github.com/Textualize/textual/issues/3178 has
# the context for the encode/decode here.
for event in parser.feed(
"".join(keys).encode("utf-16", "surrogatepass").decode("utf-16")
):
self.process_event(event) self.process_event(event)
if new_size is not None: if new_size is not None:
# Process changed size # Process changed size