[Patch/Feature] capture-pane is stripping meaningful trailing whitespace

13 views
Skip to first unread message

Leon Winter

unread,
Aug 1, 2019, 2:40:56 AM8/1/19
to tmux-...@googlegroups.com
Hi,

test setup:
rxvt -geometry 80x26 -e tmux new-session \
'printf "\033[31m\033[44mE\033[7m\033[39m\033[49m\
%8s|%16s|%7s|%5s|%21s|%35s" a b c d e f; read'

then output the buffer with:
tmux capture-pane -p -e

As one can see the output of capture-pane does not correspond with the visual
display inside tmux: The end of the first line, which is background-inverted
whitespace as stripped.

The man page states
" -J joins wrapped lines and preserves trailing spaces at each line's end."
and infact when we use -J the trailing whitespace will be kept inplace,
unfortunately then however like the option is named lines will be joined
together so the captured output again does not correspond visually to the
content of the buffer. This behaviour is therefore intended but in our case very
unfortunate.

All of this is happening because the escape sequences with its background
setting gave meaning to the normally useless whitespace. If we chose to output
escape sequences with -e we might stop stripping whitespaces. Or we introduce a
new option that prevents stripping without joining lines. For the latter I added
a patch (which is trivial).

Regards,
Leon
tmux-2.9.diff

Nicholas Marriott

unread,
Aug 1, 2019, 2:46:33 AM8/1/19
to Leon Winter, tmux-users
What is the use case?



--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/20190801064054.GB15763%40bfw-online.de.

Leon Winter

unread,
Aug 1, 2019, 3:11:23 AM8/1/19
to Nicholas Marriott, Leon Winter, tmux-users
> What is the use case?

I store the captured output and diff(1) it during automated tests. The clients
inside tmux (e.g. screen) generate such output.

Nicholas Marriott

unread,
Aug 1, 2019, 3:20:46 AM8/1/19
to Leon Winter, tmux-users
Hmm. I'm inclined to think -e should preserve whitespace but now that it doesn't we might as well do a new flag for all the cost of that, I'll take a look.

Nicholas Marriott

unread,
Aug 1, 2019, 6:03:11 AM8/1/19
to Leon Winter, tmux-users
Applied now, thanks!
Reply all
Reply to author
Forward
0 new messages