summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/grid.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2013-03-25 10:05:35 +0000
committernicm <nicm@openbsd.org>2013-03-25 10:05:35 +0000
commitd5aaf01d7895f5191fbc5e0aa8ef52a907f2a447 (patch)
tree118b91d4a9a4fbe214942852af0c389d6bfbab76 /usr.bin/tmux/grid.c
parentPrint %%error not %%end guard on error, from George Nachman. (diff)
downloadwireguard-openbsd-d5aaf01d7895f5191fbc5e0aa8ef52a907f2a447.tar.xz
wireguard-openbsd-d5aaf01d7895f5191fbc5e0aa8ef52a907f2a447.zip
Preserve trailing spaces with capture-pane -J, from George Nachman.
Diffstat (limited to 'usr.bin/tmux/grid.c')
-rw-r--r--usr.bin/tmux/grid.c10
1 files changed, 6 insertions, 4 deletions
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);