将文本行换成指定的字符长度限制,并支持ansi颜色代码

问题描述 投票:0回答:1

我想包装一些文本以适合我的终端。我目前使用fold -s -w 80,但这会计算ansi颜色代码,这会使它过早地包裹彩色线条。

shell terminal colors word-wrap ansi
1个回答
0
投票
# brew install cpanm
cpanm App::ansifold
# cpanm -V # to find install dir
# /usr/local/Cellar/perl/5.30.1/bin/ansifold
# use just like fold: `ansifold -s -w 80`

ansifold正确换行的示例屏幕截图:enter image description hereenter image description here

© www.soinside.com 2019 - 2024. All rights reserved.