Help: Truncating terminal output to fit window

72 views
Skip to first unread message

Adam Labus

unread,
Sep 11, 2024, 12:00:12 PM (8 days ago) Sep 11
to golang-nuts

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.

Reply all
Reply to author
Forward
0 new messages