-
Notifications
You must be signed in to change notification settings - Fork 784
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
Extra space when saved to SVG #4929
Comments
It looks like this may be some weird interaction between the emoji and the added style for the extension - presumably the usual issue of emoji widths? If you remove the styling for the extension, the screenshot no longer shows that empty space. I didn't think the screenshots in the docs had this empty space before, so I quickly checked the history using git bisect. It looks like this was introduced with the normalisation of the SVGs in #4675. from textual.app import App, ComposeResult
from textual.widgets import DirectoryTree
class DirectoryTreeApp(App):
CSS = """
DirectoryTree > .directory-tree--extension {
text-style: none;
}
"""
def compose(self) -> ComposeResult:
yield DirectoryTree("./")
if __name__ == "__main__":
app = DirectoryTreeApp()
app.run() |
That rings a bell. It is an issue with Textual's notion of character widths not matching the browser's. Segments are positioned according to where Textual things the character starts. When segments are combined, it can result in emoji not being where you would expect. The normalization of segments is a good thing for tests. It means that inconsequential changes don't break all the snapshots. But it can produce lower quality SVGs. I think the solution may be to offer the normalization on a switch, so that screenshots are exported without it, but tests are still normalized. |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
Running the
DirectoryTree
widget example gives this:But when saved to SVG with the command palette, an extra space is added:
The text was updated successfully, but these errors were encountered: