tmux 捕获窗格没有正确打印所有文本,而是在几个字符后插入换行符

tmux capture-pane doesn't print all texts properly but inserts newline after a few characters instead

我这里有这个脚本:

tmux send-keys "${@:1}" Enter
sleep 2.5; tmux capture-pane -p -S -32767

此脚本捕获 tmux 窗格并打印输出。我注意到如果未打开 tmux 窗格,输出将如下所示:

L 05/15/2018 - 16:07:43
: "thebravelittleMercen
ary<348><[U:1:313493299
]><Blue>" say "!resizem
ytorso"
BOI: !resizemyhands
L 05/15/2018 - 16:07:44
: "BOI<377><[U:1:453920
082]><Red>" say "!resiz
emyhands"

实际上,它应该是这样的:

L 05/15/2018 - 16:07:43: "thebravelittleMercenary<348><[U:1:313493299]><Blue>" say "!resizemytorso"
BOI: !resizemyhands
L 05/15/2018 - 16:07:44: "BOI<377><[U:1:453920082]><Red>" say "!resizemyhands"

值得一提的是,当我执行 tmux attach 并捕获窗格时,输出行的长度与我的控制台宽度相同:http://i.cubeupload.com/Rp1BEU.png

窗格中的输出为 "wrapped",因此您需要使用:

capture-pane -J

-J joins wrapped lines and preserves trailing spaces at each line's end.

https://docs.oracle.com/cd/E86824_01/html/E54763/tmux-1.html