summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-03-25 10:05:36 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-03-25 10:05:36 +0000
commit6d762cea37f5d0d2e9e0ad25ebd8f895999e1f7c (patch)
treea2dc4cd8b34c7ead2b2e6c4c511f450c94ac2435 /usr.bin
parent351d826b6e5021930934206399a87c9051cf5f6a (diff)
Preserve trailing spaces with capture-pane -J, from George Nachman.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-capture-pane.c4
-rw-r--r--usr.bin/tmux/grid-view.c4
-rw-r--r--usr.bin/tmux/grid.c10
-rw-r--r--usr.bin/tmux/tmux.14
-rw-r--r--usr.bin/tmux/tmux.h4
5 files changed, 14 insertions, 12 deletions
diff --git a/usr.bin/tmux/cmd-capture-pane.c b/usr.bin/tmux/cmd-capture-pane.c
index 6f7bd0ef9eb..a3676944c36 100644
--- a/usr.bin/tmux/cmd-capture-pane.c
+++ b/usr.bin/tmux/cmd-capture-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-capture-pane.c,v 1.21 2013/03/25 10:04:04 nicm Exp $ */
+/* $OpenBSD: cmd-capture-pane.c,v 1.22 2013/03/25 10:05:35 nicm Exp $ */
/*
* Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net>
@@ -111,7 +111,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq)
gc = NULL;
for (i = top; i <= bottom; i++) {
line = grid_string_cells(gd, 0, i, sx, &gc, with_codes,
- escape_c0);
+ escape_c0, !join_lines);
linelen = strlen(line);
buf = xrealloc(buf, 1, len + linelen + 1);
diff --git a/usr.bin/tmux/grid-view.c b/usr.bin/tmux/grid-view.c
index 1c4c27a52b5..32c36a7d978 100644
--- a/usr.bin/tmux/grid-view.c
+++ b/usr.bin/tmux/grid-view.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grid-view.c,v 1.13 2013/03/22 15:56:11 nicm Exp $ */
+/* $OpenBSD: grid-view.c,v 1.14 2013/03/25 10:05:35 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -234,5 +234,5 @@ grid_view_string_cells(struct grid *gd, u_int px, u_int py, u_int nx)
px = grid_view_x(gd, px);
py = grid_view_y(gd, py);
- return (grid_string_cells(gd, px, py, nx, NULL, 0, 0));
+ return (grid_string_cells(gd, px, py, nx, NULL, 0, 0, 0));
}
diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c
index 8842206f7f9..369beff2646 100644
--- a/usr.bin/tmux/grid.c
+++ b/usr.bin/tmux/grid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grid.c,v 1.27 2013/03/25 10:01:43 nicm Exp $ */
+/* $OpenBSD: grid.c,v 1.28 2013/03/25 10:05:35 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -583,7 +583,7 @@ grid_string_cells_code(const struct grid_cell *lastgc,
/* Convert cells into a string. */
char *
grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx,
- struct grid_cell **lastgc, int with_codes, int escape_c0)
+ struct grid_cell **lastgc, int with_codes, int escape_c0, int trim)
{
const struct grid_cell *gc;
static struct grid_cell lastgc1;
@@ -638,8 +638,10 @@ grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx,
off += size;
}
- while (off > 0 && buf[off - 1] == ' ')
- off--;
+ if (trim) {
+ while (off > 0 && buf[off - 1] == ' ')
+ off--;
+ }
buf[off] = '\0';
return (buf);
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 7e095b371d7..a65234f921a 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.340 2013/03/25 10:04:04 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.341 2013/03/25 10:05:35 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -1088,7 +1088,7 @@ attributes.
.Fl C
also escapes non-printable characters as octal \exxx.
.Fl J
-joins wrapped lines.
+joins wrapped lines and preserves trailing spaces at each line's end.
.Pp
.Fl S
and
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 652c6b9f6d0..e287d2d9ac7 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.399 2013/03/24 09:58:40 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.400 2013/03/25 10:05:35 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -2006,7 +2006,7 @@ void grid_clear_lines(struct grid *, u_int, u_int);
void grid_move_lines(struct grid *, u_int, u_int, u_int);
void grid_move_cells(struct grid *, u_int, u_int, u_int, u_int);
char *grid_string_cells(struct grid *, u_int, u_int, u_int,
- struct grid_cell **, int, int);
+ struct grid_cell **, int, int, int);
void grid_duplicate_lines(
struct grid *, u_int, struct grid *, u_int, u_int);
u_int grid_reflow(struct grid *, struct grid *, u_int);