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

Truncated bottom of the last line of command outputs when redirected to SVG #8

Open
dottspina opened this issue Dec 7, 2024 · 1 comment

Comments

@dottspina
Copy link
Owner

dottspina commented Dec 7, 2024

The bottom of the last line of a captured command output is truncated when redirected to SVG files.

This is barely visible, but:

  • obvious if the last line contains underscore _ characters, which will look like white spaces (i.e. SOC_FULL_DIR will appear as SOC FULL DIR)
  • also visible, if you pay attention, for e.g. the bottom leg of the y letter

This is possibly an issue with the clipped area computed by the rich library in Console.export_svg(): we reported our concern upstream [1].

References:

dottspina added a commit that referenced this issue Dec 9, 2024
Workaround upstream rich library issue 3576:
Underscores on the last captured line are clipped
when exporting to SVG.

The main <clipPath> height computed
by the rich library in Console.export_svg() is a bit too small,
and the bottom of the last captured output line may be truncated,
depending on the font and the printed characters (e.g. underscores,
but also the bottom of the letter 'y').

This workaround adds the bottom padding to the height computed
by the rich library.

Ref:
- #8
- Textualize/rich#3576
@dottspina
Copy link
Owner Author

DTSh 0.2.4 includes a work around for this issue (commit e3f9828).

Keeping it open since we may revert our patch when the bug is fixed upstream in Textualize's rich library.

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

1 participant