Skip to content

Commit a44119d

Browse files
authored
Merge pull request #4571 from Textualize/bind-fix
fix for bindings not refreshed
2 parents 4adaf03 + 3d8ffb5 commit a44119d

File tree

3 files changed

+29
-20
lines changed

3 files changed

+29
-20
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8-
## [0.63.5]
8+
## [0.63.6] - 2024-05-29
9+
10+
### Fixed
11+
12+
- Fixed issue with bindings not refreshing https://github.com/Textualize/textual/pull/4571
13+
14+
## [0.63.5] - 2024-05-28
915

1016
### Fixed
1117

@@ -15,7 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1521

1622
- Added `Styles.is_auto_width` and `Style.is_auto_height`
1723

18-
## [0.63.4]
24+
## [0.63.4] - 2024-05-26
1925

2026
### Added
2127

@@ -2033,6 +2039,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040
20332039
- New handler system for messages that doesn't require inheritance
20342040
- Improved traceback handling
20352041

2042+
[0.63.6]: https://github.com/Textualize/textual/compare/v0.63.5...v0.63.6
20362043
[0.63.5]: https://github.com/Textualize/textual/compare/v0.63.4...v0.63.5
20372044
[0.63.4]: https://github.com/Textualize/textual/compare/v0.63.3...v0.63.4
20382045
[0.63.3]: https://github.com/Textualize/textual/compare/v0.63.2...v0.63.3

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "textual"
3-
version = "0.63.5"
3+
version = "0.63.6"
44
homepage = "https://github.com/Textualize/textual"
55
repository = "https://github.com/Textualize/textual"
66
documentation = "https://textual.textualize.io/"

src/textual/screen.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ def scroll_to_center(widget: Widget) -> None:
721721
self.log.debug(widget, "was focused")
722722

723723
self._update_focus_styles(focused, blurred)
724-
self.call_after_refresh(self.refresh_bindings)
724+
self.refresh_bindings()
725725

726726
def _extend_compose(self, widgets: list[Widget]) -> None:
727727
"""Insert Textual's own internal widgets.
@@ -742,27 +742,29 @@ def _on_mount(self, event: events.Mount) -> None:
742742
self.screen_layout_refresh_signal.subscribe(
743743
self, self._maybe_clear_tooltip, immediate=True
744744
)
745+
self.refresh_bindings()
745746

746747
async def _on_idle(self, event: events.Idle) -> None:
747748
# Check for any widgets marked as 'dirty' (needs a repaint)
748749
event.prevent_default()
749750

750-
if not self.app._batch_count and self.is_current:
751-
if (
752-
self._layout_required
753-
or self._scroll_required
754-
or self._repaint_required
755-
or self._recompose_required
756-
or self._dirty_widgets
757-
):
758-
self._update_timer.resume()
759-
return
760-
761-
await self._invoke_and_clear_callbacks()
762-
763-
if self._bindings_updated:
764-
self._bindings_updated = False
765-
self.app.call_later(self.bindings_updated_signal.publish, self)
751+
try:
752+
if not self.app._batch_count and self.is_current:
753+
if (
754+
self._layout_required
755+
or self._scroll_required
756+
or self._repaint_required
757+
or self._recompose_required
758+
or self._dirty_widgets
759+
):
760+
self._update_timer.resume()
761+
return
762+
763+
await self._invoke_and_clear_callbacks()
764+
finally:
765+
if self._bindings_updated:
766+
self._bindings_updated = False
767+
self.app.call_later(self.bindings_updated_signal.publish, self)
766768

767769
def _compositor_refresh(self) -> None:
768770
"""Perform a compositor refresh."""

0 commit comments

Comments
 (0)