diff --git a/CHANGELOG.md b/CHANGELOG.md index c2400363db..b66a10519b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [0.63.0] - Unreleased +## [0.63.0] - 2024-05-22 + +### Fixed + +- Fixed actions in links ### Changed @@ -1985,6 +1989,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040 - New handler system for messages that doesn't require inheritance - Improved traceback handling +[0.63.0]: https://github.com/Textualize/textual/compare/v0.62.0...v0.63.0 [0.62.0]: https://github.com/Textualize/textual/compare/v0.61.1...v0.62.0 [0.61.1]: https://github.com/Textualize/textual/compare/v0.61.0...v0.61.1 [0.61.0]: https://github.com/Textualize/textual/compare/v0.60.1...v0.61.0 diff --git a/pyproject.toml b/pyproject.toml index 25cb9d25f8..40af402d59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "textual" -version = "0.62.0" +version = "0.63.0" homepage = "https://github.com/Textualize/textual" repository = "https://github.com/Textualize/textual" documentation = "https://textual.textualize.io/" diff --git a/src/textual/app.py b/src/textual/app.py index cfdcc67d57..8d05aefd46 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -3175,10 +3175,16 @@ async def _broker_event( return False else: event.stop() + if isinstance(action, str): await self.run_action(action, default_namespace) elif isinstance(action, tuple) and len(action) == 2: - await self.run_action(("", *action), default_namespace) + action_name, action_params = action + namespace, parsed_action, _ = actions.parse(action_name) + await self.run_action( + (namespace, parsed_action, action_params), + default_namespace, + ) elif callable(action): await action() else: diff --git a/tests/test_links.py b/tests/test_links.py new file mode 100644 index 0000000000..e88c3f49d4 --- /dev/null +++ b/tests/test_links.py @@ -0,0 +1,24 @@ +from textual.app import App, ComposeResult +from textual.screen import Screen +from textual.widgets import Label + + +async def test_links(): + """Regression test for https://github.com/Textualize/textual/issues/4536""" + messages: list[str] = [] + + class HomeScreen(Screen[None]): + def compose(self) -> ComposeResult: + yield Label("[@click=app.bell_message('hi')]Ring the bell![/]") + + class ScreenNamespace(App[None]): + def get_default_screen(self) -> HomeScreen: + return HomeScreen() + + def action_bell_message(self, message: str) -> None: + nonlocal messages + messages.append(message) + + async with ScreenNamespace().run_test() as pilot: + await pilot.click(offset=(5, 0)) + assert messages == ["hi"]