Skip to content

Commit 45f66be

Browse files
authored
Merge pull request #6314 from Textualize/resume-update
Add optional refresh to resume message
2 parents a604748 + ba26b7e commit 45f66be

File tree

7 files changed

+36
-11
lines changed

7 files changed

+36
-11
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@ 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+
## [7.0.1] - 2026-01-07
9+
10+
### Added
11+
12+
- Added a `refresh_styles` boolean to the `ScreenResult` message which reduces style updates when popping screens
13+
814
## [7.0.0] - 2026-01-03
915

1016
### Changed
1117

1218
- `Node.update_node_styles` has grown a `animate` parameter
1319

20+
### Added
21+
22+
- Added atom-one-dark and atom-one-light themes @NSPC911 https://github.com/Textualize/textual/pull/6301
23+
1424
## [6.12.0] - 2026-01-02
1525

1626
### Fixed
@@ -3268,6 +3278,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040
32683278
- New handler system for messages that doesn't require inheritance
32693279
- Improved traceback handling
32703280

3281+
[7.0.1]: https://github.com/Textualize/textual/compare/v7.0.0...v7.0.1
32713282
[7.0.0]: https://github.com/Textualize/textual/compare/v6.11.0...v7.0.0
32723283
[6.11.0]: https://github.com/Textualize/textual/compare/v6.10.0...v6.11.0
32733284
[6.10.0]: https://github.com/Textualize/textual/compare/v6.9.0...v6.10.0

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 = "7.0.0"
3+
version = "7.0.1"
44
homepage = "https://github.com/Textualize/textual"
55
repository = "https://github.com/Textualize/textual"
66
documentation = "https://textual.textualize.io/"

src/textual/_resolve.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,16 @@ def resolve_box_models(
317317
)
318318

319319
remaining_space = int(max(0, size.height - total_remaining - margin_height))
320+
320321
fraction_unit = resolve_fraction_unit(
321322
[
322323
styles
323324
for styles in widget_styles
324-
if styles.height is not None
325-
and styles.height.is_fraction
326-
and styles.overlay != "screen"
325+
if (
326+
styles.height is not None
327+
and styles.height.is_fraction
328+
and styles.overlay != "screen"
329+
)
327330
],
328331
size,
329332
viewport_size,

src/textual/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2979,7 +2979,9 @@ def pop_screen(self) -> AwaitComplete:
29792979

29802980
previous_screen = screen_stack.pop()
29812981
previous_screen._pop_result_callback()
2982-
self.screen.post_message(events.ScreenResume())
2982+
self.screen.post_message(
2983+
events.ScreenResume(refresh_styles=previous_screen.styles.background.a < 0)
2984+
)
29832985
self.log.system(f"{self.screen} is active")
29842986

29852987
async def do_pop() -> None:

src/textual/events.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,13 +901,20 @@ def __rich_repr__(self) -> rich.repr.Result:
901901
yield "text", self.text
902902

903903

904+
@dataclass
904905
class ScreenResume(Event, bubble=False):
905906
"""Sent to screen that has been made active.
906907
907908
- [ ] Bubbles
908909
- [ ] Verbose
909910
"""
910911

912+
refresh_styles: bool = True
913+
"""Should the resuming screen refresh its styles?"""
914+
915+
def __rich_repr__(self) -> rich.repr.Result:
916+
yield self.refresh_styles
917+
911918

912919
class ScreenSuspend(Event, bubble=False):
913920
"""Sent to screen when it is no longer active.

src/textual/screen.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ def _screen_resized(self, size: Size) -> None:
14271427
if self.stack_updates and self.is_attached:
14281428
self._refresh_layout(size)
14291429

1430-
def _on_screen_resume(self) -> None:
1430+
def _on_screen_resume(self, event: events.ScreenResume) -> None:
14311431
"""Screen has resumed."""
14321432
if self.app.SUSPENDED_SCREEN_CLASS:
14331433
self.remove_class(self.app.SUSPENDED_SCREEN_CLASS)
@@ -1441,8 +1441,10 @@ def _on_screen_resume(self) -> None:
14411441

14421442
if self.is_attached:
14431443
self._compositor_refresh()
1444-
self.update_node_styles(animate=False)
1445-
self._refresh_layout(size)
1444+
if event.refresh_styles:
1445+
self.update_node_styles(animate=False)
1446+
if self._size != size:
1447+
self._refresh_layout(size)
14461448
self.refresh()
14471449

14481450
async def _compose(self) -> None:

src/textual/widgets/_collapsible.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class CollapsibleTitle(Static, can_focus=True):
2121
DEFAULT_CSS = """
2222
CollapsibleTitle {
2323
width: auto;
24-
height: auto;
25-
padding: 0 1;
24+
height: auto;
25+
padding: 0 1;
2626
text-style: $block-cursor-blurred-text-style;
2727
color: $block-cursor-blurred-foreground;
2828
@@ -160,7 +160,7 @@ class Contents(Container):
160160
Contents {
161161
width: 100%;
162162
height: auto;
163-
padding: 1 0 0 3;
163+
padding: 1 0 0 3;
164164
}
165165
"""
166166

0 commit comments

Comments
 (0)