bczsalba / Termage

Generate SVGs from any Python code, even in your documentation.
https://termage.bczsalba.com
MIT License
23 stars 0 forks source link

[BUG] Terminal initialization codes visible in VTE3 terminals: “^[[4;1120;1917” #5

Closed kseistrup closed 2 years ago

kseistrup commented 2 years ago

Describe the bug

When invoking termage in a VTE3 based terminal emulator, e.g. with termage -h, something that I suspect is terminal initialization codes are visible.

To Reproduce

  1. Open a VTE3 based terminal, e.g. terminator or sakura.
  2. Invoke termage with termage -h
  3. Enjoy the pretty sprinkles at the beginning and at the end of the help text.

Expected behavior

Teminal initialization codes ought to be invisible for the casual user.

Screenshots

In the screenshot of a terminator window just below the sprinkles can be clearly seen:

termage-ckb7yon68sg8

Platform info

I have seen it happen in VTE3 based terminal emulators:

But not in terminal emulators that are not based on VTE3:

PTG

Termage doesn't have a --version option, but pip has installed v0.2.0.

bczsalba commented 2 years ago

This is related to issue https://github.com/bczsalba/pytermgui/issues/69. Basically, PTG queries the terminal's pixel resolution, but does it with a short timeout so as to hang execution in terminals that don't support it. At some point it will move to a more on-demand execution with a larger timeout to avoid this.

bczsalba commented 2 years ago

Latest PTG commit should fix this, will publish a release with it sometime in the next few days!