Skip to content

Commit

Permalink
Merge pull request Textualize#5516 from Textualize/refresh-jank-fix
Browse files Browse the repository at this point in the history
fix refresh jank
  • Loading branch information
willmcgugan authored Feb 12, 2025
2 parents ef681bd + 7fb15d9 commit 7344df8
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 120 deletions.
2 changes: 0 additions & 2 deletions src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions src/textual/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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 = (
Expand All @@ -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:
Expand Down
Loading

0 comments on commit 7344df8

Please sign in to comment.