Truncating terminal output to fit window

I am currently trying to build a charm application where I display the stdout and stderr of a shell program.

I am having problems deciding on how I should trim the output to fit my window. What package provides a function that trims text respecting ANSI escape codes, emojis and other special characters, so that I can trim stdout of the program to be the size of my window? There also comes the task of ending all ANSI color escape codes so that the colors don’t spill over to my border and such. I want to do as little terminal specific things in my app as possible.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.