diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fbc58b44f..2da1593369 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `Pilot.click`/`Pilot.hover` can't use `Screen` as a selector https://github.com/Textualize/textual/issues/3395 - App exception when a `Tree` is initialized/mounted with `disabled=True` https://github.com/Textualize/textual/issues/3407 +- Fixed application freeze when pasting an emoji into an application on Windows https://github.com/Textualize/textual/issues/3178 ### Added diff --git a/src/textual/drivers/win32.py b/src/textual/drivers/win32.py index 214fb28dc5..5751af2caa 100644 --- a/src/textual/drivers/win32.py +++ b/src/textual/drivers/win32.py @@ -278,7 +278,12 @@ def run(self) -> None: if 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) if new_size is not None: # Process changed size