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
--
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 [email protected].
To view this discussion on the web, visit
https://groups.google.com/d/msgid/tmux-users/20190801064054.GB15763%40bfw-online.de.
diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c
index a3ec066..fc6c26e 100644
--- a/cmd-capture-pane.c
+++ b/cmd-capture-pane.c
@@ -39,8 +39,8 @@ const struct cmd_entry cmd_capture_pane_entry = {
.name = "capture-pane",
.alias = "capturep",
- .args = { "ab:CeE:JpPqS:t:", 0, 0 },
- .usage = "[-aCeJpPq] " CMD_BUFFER_USAGE " [-E end-line] "
+ .args = { "ab:CeE:JNpPqS:t:", 0, 0 },
+ .usage = "[-aCeJNpPq] " CMD_BUFFER_USAGE " [-E end-line] "
"[-S start-line] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 },
@@ -110,7 +110,7 @@ cmd_capture_pane_history(struct args *args, struct cmdq_item *item,
struct grid *gd;
const struct grid_line *gl;
struct grid_cell *gc = NULL;
- int n, with_codes, escape_c0, join_lines;
+ int n, with_codes, escape_c0, join_lines, no_trim;
u_int i, sx, top, bottom, tmp;
char *cause, *buf, *line;
const char *Sflag, *Eflag;
@@ -170,11 +170,12 @@ cmd_capture_pane_history(struct args *args, struct cmdq_item *item,
with_codes = args_has(args, 'e');
escape_c0 = args_has(args, 'C');
join_lines = args_has(args, 'J');
+ no_trim = args_has(args, 'N');
buf = NULL;
for (i = top; i <= bottom; i++) {
line = grid_string_cells(gd, 0, i, sx, &gc, with_codes,
- escape_c0, !join_lines);
+ escape_c0, !join_lines && !no_trim);
linelen = strlen(line);
buf = cmd_capture_pane_append(buf, len, line, linelen);