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

Inline glitch with 1 line screen #5016

Closed
willmcgugan opened this issue Sep 18, 2024 · 4 comments · Fixed by #5054
Closed

Inline glitch with 1 line screen #5016

willmcgugan opened this issue Sep 18, 2024 · 4 comments · Fixed by #5054

Comments

@willmcgugan
Copy link
Collaborator

I think there is a glitch when an inline app is 1 character high. The line gets repeated.

This occurred when a Tree was auto height, and there was a single node.

@TomJGooding
Copy link
Contributor

I'm probably wrong, but from a quick look at the InlineUpdate maybe this is where the cursor isn't moved up when there's only the single 'strip' (line) to render?

if len(self.strips) > 1:
back_lines = len(self.strips) if self.clear else len(self.strips) - 1
append(f"\x1b[{back_lines}A\r") # Move cursor back to original position
else:
append("\r")

Here's my quick MRE if it helps:

image

from textual.app import App, ComposeResult
from textual.widgets import Tree


class InlineGlitchApp(App):
    CSS = """
    Screen:inline {
        border: none;
    }

    Tree {
        height: auto;
    }
    """

    def compose(self) -> ComposeResult:
        tree = Tree("This line gets repeated each time I'm expanded...")
        tree.root.add_leaf("...then collapsed again")
        yield tree


if __name__ == "__main__":
    app = InlineGlitchApp()
    app.run(inline=True)

@willmcgugan
Copy link
Collaborator Author

That does look like it could be the culprit!

@willmcgugan
Copy link
Collaborator Author

Thanks for the MREs, Tom. Always a big help.

Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

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

Successfully merging a pull request may close this issue.

2 participants