diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fedafb5b1..90e4cfb1a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,13 @@ 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.5] +## [0.63.6] - 2024-05-29 + +### Fixed + +- Fixed issue with bindings not refreshing https://github.com/Textualize/textual/pull/4571 + +## [0.63.5] - 2024-05-28 ### Fixed @@ -15,7 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Added `Styles.is_auto_width` and `Style.is_auto_height` -## [0.63.4] +## [0.63.4] - 2024-05-26 ### Added @@ -2033,6 +2039,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.6]: https://github.com/Textualize/textual/compare/v0.63.5...v0.63.6 [0.63.5]: https://github.com/Textualize/textual/compare/v0.63.4...v0.63.5 [0.63.4]: https://github.com/Textualize/textual/compare/v0.63.3...v0.63.4 [0.63.3]: https://github.com/Textualize/textual/compare/v0.63.2...v0.63.3 diff --git a/pyproject.toml b/pyproject.toml index 3470afd8d7..b2485fdeec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "textual" -version = "0.63.5" +version = "0.63.6" homepage = "https://github.com/Textualize/textual" repository = "https://github.com/Textualize/textual" documentation = "https://textual.textualize.io/" diff --git a/src/textual/screen.py b/src/textual/screen.py index 9b724cd386..7de975fe2d 100644 --- a/src/textual/screen.py +++ b/src/textual/screen.py @@ -721,7 +721,7 @@ def scroll_to_center(widget: Widget) -> None: self.log.debug(widget, "was focused") self._update_focus_styles(focused, blurred) - self.call_after_refresh(self.refresh_bindings) + self.refresh_bindings() def _extend_compose(self, widgets: list[Widget]) -> None: """Insert Textual's own internal widgets. @@ -742,27 +742,29 @@ def _on_mount(self, event: events.Mount) -> None: self.screen_layout_refresh_signal.subscribe( self, self._maybe_clear_tooltip, immediate=True ) + self.refresh_bindings() async def _on_idle(self, event: events.Idle) -> None: # Check for any widgets marked as 'dirty' (needs a repaint) event.prevent_default() - if not self.app._batch_count and self.is_current: - if ( - self._layout_required - or self._scroll_required - or self._repaint_required - or self._recompose_required - or self._dirty_widgets - ): - self._update_timer.resume() - return - - await self._invoke_and_clear_callbacks() - - if self._bindings_updated: - self._bindings_updated = False - self.app.call_later(self.bindings_updated_signal.publish, self) + try: + if not self.app._batch_count and self.is_current: + if ( + self._layout_required + or self._scroll_required + or self._repaint_required + or self._recompose_required + or self._dirty_widgets + ): + self._update_timer.resume() + return + + await self._invoke_and_clear_callbacks() + finally: + if self._bindings_updated: + self._bindings_updated = False + self.app.call_later(self.bindings_updated_signal.publish, self) def _compositor_refresh(self) -> None: """Perform a compositor refresh."""