Re: terminal width
Alexis <[email protected]> Fri, 03 Apr 2026 10:22:05 +1100
| Newsgroups | gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <[email protected]> |
Ray Andrews <[email protected]> writes: > If I have a ragged array that I want to cut down to terminal > width > this is fine for each line: > > output[line_number]=$input[1, $COLUMNS] > > ... if there are no color codes or tabs. If there are, the > predictable thing happens. Using 'cut' has exactly the same > problem. > I doubt the shell can be asked to deal with that, but I'll ask > anyway. Could be that ncurses, or something, will handle it. > Or > maybe somebody knows of a utility that can. I understand that > it's > a > can of worms tho. My apologies if i'm not correctly understanding what you're after, but ansifilter(1): https://manpages.debian.org/trixie/ansifilter/ansifilter.1.en.html can strip ANSI escape sequences, and sed(1) could e.g. convert each tab to a single space. Alexis.