diff --git a/src/textual/app.py b/src/textual/app.py index 3c773f7837..83aecc4220 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -2650,7 +2650,6 @@ def push_screen( if self._screen_stack: self.screen.post_message(events.ScreenSuspend()) - self.screen.refresh() next_screen, await_mount = self._get_screen(screen) try: message_pump = active_message_pump.get() @@ -2660,7 +2659,6 @@ def push_screen( next_screen._push_result_callback(message_pump, callback, future) self._load_screen_css(next_screen) self._screen_stack.append(next_screen) - self.stylesheet.update(next_screen) next_screen.post_message(events.ScreenResume()) self.log.system(f"{self.screen} is current (PUSHED)") if wait_for_dismiss: diff --git a/src/textual/screen.py b/src/textual/screen.py index edc58fa7fc..b4cc10de90 100644 --- a/src/textual/screen.py +++ b/src/textual/screen.py @@ -1309,8 +1309,8 @@ def _get_inline_height(self, size: Size) -> int: def _screen_resized(self, size: Size): """Called by App when the screen is resized.""" if self.stack_updates: - self._compositor_refresh() self._refresh_layout(size) + self._compositor_refresh() def _on_screen_resume(self) -> None: """Screen has resumed.""" @@ -1320,8 +1320,6 @@ def _on_screen_resume(self) -> None: self.app._refresh_notifications() size = self.app.size - self._refresh_layout(size) - self.refresh() # Only auto-focus when the app has focus (textual-web only) if self.app.app_focus: auto_focus = ( @@ -1333,6 +1331,9 @@ def _on_screen_resume(self) -> None: self.set_focus(widget) break + self.app.stylesheet.update(self) + self._refresh_layout(size) + def _on_screen_suspend(self) -> None: """Screen has suspended.""" if self.app.SUSPENDED_SCREEN_CLASS: diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_log_write.svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_log_write.svg index 3573a3974c..a6d0c077be 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_log_write.svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_log_write.svg @@ -19,131 +19,132 @@ font-weight: 700; } - .terminal-845572209-matrix { + .terminal-2341186265-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-845572209-title { + .terminal-2341186265-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-845572209-r1 { fill: #e2e2e2 } -.terminal-845572209-r2 { fill: #c5c8c6 } + .terminal-2341186265-r1 { fill: #e2e2e2 } +.terminal-2341186265-r2 { fill: #c5c8c6 } +.terminal-2341186265-r3 { fill: #e1e1e1 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - LogApp + LogApp - - - - Hello, World! -What's up? -FOO - - - - - - - - - - - - - - - - - - - - + + + + Hello, World! +What's up? +FOO + + + + + + + + + + + + + + + + + + + + diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_log_write_lines.svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_log_write_lines.svg index f2803229ba..262fafddde 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_log_write_lines.svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_log_write_lines.svg @@ -19,137 +19,137 @@ font-weight: 700; } - .terminal-2008398993-matrix { + .terminal-1264172171-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2008398993-title { + .terminal-1264172171-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2008398993-r1 { fill: #e2e2e2 } -.terminal-2008398993-r2 { fill: #272727 } -.terminal-2008398993-r3 { fill: #e1e1e1 } -.terminal-2008398993-r4 { fill: #c5c8c6 } -.terminal-2008398993-r5 { fill: #000000 } -.terminal-2008398993-r6 { fill: #003054 } -.terminal-2008398993-r7 { fill: #1e1e1e } + .terminal-1264172171-r1 { fill: #e2e2e2 } +.terminal-1264172171-r2 { fill: #272727 } +.terminal-1264172171-r3 { fill: #e1e1e1 } +.terminal-1264172171-r4 { fill: #c5c8c6 } +.terminal-1264172171-r5 { fill: #000000 } +.terminal-1264172171-r6 { fill: #003054 } +.terminal-1264172171-r7 { fill: #1e1e1e } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - LogApp + LogApp - + - - I must not fear.And when it has goHello, WorldFear is the mind-k -Fear is the mind-kWhere the fear hasFear is the little -Fear is the littleI must not fear.I will face my fea -I will face my fea▁▁Fear is the mind-kI will permit it t -I will permit it tFear is the littleAnd when it has go -And when it has goI will face my feaWhere the fear has -Where the fear hasI will permit it t -I must not fear.And when it has go -Fear is the mind-kWhere the fear has -Fear is the littleI must not fear. -I will face my feaFear is the mind-k -I will permit it tFear is the little -And when it has goI will face my fea -Where the fear hasI will permit it t -I must not fear.And when it has go -Fear is the mind-kWhere the fear has -Fear is the littleI must not fear. -I will face my feaFear is the mind-k -I will permit it tFear is the little -And when it has goI will face my fea▇▇ -Where the fear hasI will permit it t -I must not fear.And when it has go -Fear is the mind-kWhere the fear has - + + I must not fear.And when it has goHello, WorldFear is the mind-k +Fear is the mind-kWhere the fear hasFear is the little +Fear is the littleI must not fear.I will face my fea +I will face my fea▁▁Fear is the mind-kI will permit it t +I will permit it tFear is the littleAnd when it has go +And when it has goI will face my feaWhere the fear has +Where the fear hasI will permit it t +I must not fear.And when it has go +Fear is the mind-kWhere the fear has +Fear is the littleI must not fear. +I will face my feaFear is the mind-k +I will permit it tFear is the little +And when it has goI will face my fea +Where the fear hasI will permit it t +I must not fear.And when it has go +Fear is the mind-kWhere the fear has +Fear is the littleI must not fear. +I will face my feaFear is the mind-k +I will permit it tFear is the little +And when it has goI will face my fea▇▇ +Where the fear hasI will permit it t +I must not fear.And when it has go +Fear is the mind-kWhere the fear has +