mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- Fixed double-paste into `Input` https://github.com/Textualize/textual/issues/1657
|
- Fixed double-paste into `Input` https://github.com/Textualize/textual/issues/1657
|
||||||
- Added a workaround for an apparent Windows Terminal paste issue https://github.com/Textualize/textual/issues/1661
|
- Added a workaround for an apparent Windows Terminal paste issue https://github.com/Textualize/textual/issues/1661
|
||||||
- Fixes issue with renderable width calculation https://github.com/Textualize/textual/issues/1685
|
- Fixes issue with renderable width calculation https://github.com/Textualize/textual/issues/1685
|
||||||
|
- Fixed issue with app not processing Paste event https://github.com/Textualize/textual/issues/1666
|
||||||
|
|
||||||
## [0.10.1] - 2023-01-20
|
## [0.10.1] - 2023-01-20
|
||||||
|
|
||||||
|
|||||||
@@ -1901,9 +1901,11 @@ class App(Generic[ReturnType], DOMNode):
|
|||||||
else:
|
else:
|
||||||
await self.screen._forward_event(event)
|
await self.screen._forward_event(event)
|
||||||
|
|
||||||
elif isinstance(event, events.Paste):
|
elif isinstance(event, events.Paste) and not event.is_forwarded:
|
||||||
if self.focused is not None:
|
if self.focused is not None:
|
||||||
await self.focused._forward_event(event)
|
await self.focused._forward_event(event)
|
||||||
|
else:
|
||||||
|
await self.screen._forward_event(event)
|
||||||
else:
|
else:
|
||||||
await super().on_event(event)
|
await super().on_event(event)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from rich.style import Style
|
|||||||
|
|
||||||
from ._types import MessageTarget
|
from ._types import MessageTarget
|
||||||
from .geometry import Offset, Size
|
from .geometry import Offset, Size
|
||||||
from .keys import _get_key_aliases, _get_key_display
|
from .keys import _get_key_aliases
|
||||||
from .message import Message
|
from .message import Message
|
||||||
|
|
||||||
MouseEventT = TypeVar("MouseEventT", bound="MouseEvent")
|
MouseEventT = TypeVar("MouseEventT", bound="MouseEvent")
|
||||||
|
|||||||
18
tests/test_paste.py
Normal file
18
tests/test_paste.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from textual.app import App
|
||||||
|
from textual import events
|
||||||
|
|
||||||
|
|
||||||
|
async def test_paste_app():
|
||||||
|
paste_events = []
|
||||||
|
|
||||||
|
class PasteApp(App):
|
||||||
|
def on_paste(self, event):
|
||||||
|
paste_events.append(event)
|
||||||
|
|
||||||
|
app = PasteApp()
|
||||||
|
async with app.run_test() as pilot:
|
||||||
|
await app.post_message(events.Paste(sender=app, text="Hello"))
|
||||||
|
await pilot.pause(0)
|
||||||
|
|
||||||
|
assert len(paste_events) == 1
|
||||||
|
assert paste_events[0].text == "Hello"
|
||||||
Reference in New Issue
Block a user