Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display not being refreshed after App.suspend (since 0.85) #5528

Open
davep opened this issue Feb 15, 2025 · 1 comment
Open

Display not being refreshed after App.suspend (since 0.85) #5528

davep opened this issue Feb 15, 2025 · 1 comment

Comments

@davep
Copy link
Contributor

davep commented Feb 15, 2025

Using this code:

from os import system

from textual.app import App, ComposeResult
from textual.containers import Horizontal, Vertical
from textual.widgets import Footer, Header, Input


class SuspendingApp(App[None]):

    CSS = """
    Screen {
        Vertical {
            border: solid;
        }
    }
    """

    BINDINGS = [("f1", "edit")]

    def compose(self) -> ComposeResult:
        yield Header()
        with Horizontal():
            yield Vertical()
            yield Vertical()
        yield Input()
        yield Footer()

    def action_edit(self) -> None:
        with self.suspend():
            system("vim")


if __name__ == "__main__":
    SuspendingApp().run()

if you press f1 and then exit vim the screen of the Textual application doesn't fully restore:

Screen.Recording.2025-02-15.at.08.58.26.mov

Working backwards through Textual releases, the last version where App.suspend worked as intended was v0.84; it very much appears that v0.85.0 introduced this issue.

@TomJGooding
Copy link
Contributor

TomJGooding commented Feb 15, 2025

system("vim")

Joining the dark side Dave?

git bisect points to 6298acb, presumably this change in screen:

@@ -1205,8 +1205,8 @@ def _get_inline_height(self, size: Size) -> int:
 
     def _screen_resized(self, size: Size):
         """Called by App when the screen is resized."""
+        self._compositor_refresh()
         self._refresh_layout(size)
-        self.refresh()
 
     def _on_screen_resume(self) -> None:
         """Screen has resumed."""

I'm not really familiar enough with how the refreshing works to say this is the correct fix, but just sharing my findings in case it helps someone...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants