ChrisBuilds / terminaltexteffects

TerminalTextEffects (TTE) is a terminal visual effects engine, application, and Python library.
https://chrisbuilds.github.io/terminaltexteffects/
MIT License
2.81k stars 49 forks source link

Feature request: Improve handling of terminal sequences #30

Open NicoWeio opened 3 months ago

NicoWeio commented 3 months ago

The documentation does include a warning that those are not supported (here), but say one doesn't see that. In my experience, the results then vary from a few escape sequences becoming visible (neofetch | tte decrypt) to pages worth of gibberish (neofetch | tte --no-color decrypt). Couldn't we do one of the following instead?

ChrisBuilds commented 3 months ago

Output the unmodified stream (i.e. without applying any effect) if we detect any unwanted terminal sequences

Perhaps, but I think we would end up with reports from folks thinking TTE is broken rather than gracefully quitting.

Return a warning/error message

This seems like a reasonable approach.

Actually support such sequences (no clue how difficult that would be)

There is another issue open regarding supporting existing colors. It's in my todo list. That being said, Neofetch and some other applications use complex sequences to handle formatting as well as color. To fully support these, I would basically be building a sequence parser/emulator into TTE, which is beyond a reasonable scope.

I agree that TTE should do something when encountering unsupported escape sequences (aka non-color), and will consider a solution for an upcoming release. Thanks for the issue.

adavies42 commented 3 months ago

how about this?

  1. strip all terminal sequences off the text
  2. apply the tte effect
  3. replace the final frame with the original, colored/formatted text
ChrisBuilds commented 3 days ago

Just an update on this, the 0.12.0 dev branch has added support for preexisting 8/24 bit foreground and background color sequences. Support for this feature has to be added to all existing effects, so that will take time. See Issue 37 for current progress.