aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2013-08-01 23:47:45 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2013-08-01 23:47:45 +0100
commit2dfd3fbd71560aa34cffd2a8de65425876188a4f (patch)
treecf1265461beb1f4d624177d1833b889782df1ba8
parent3a13e066ba184b1051167b0675bf9b4364af021e (diff)
downloadrtmux-2dfd3fbd71560aa34cffd2a8de65425876188a4f.tar.gz
rtmux-2dfd3fbd71560aa34cffd2a8de65425876188a4f.tar.bz2
rtmux-2dfd3fbd71560aa34cffd2a8de65425876188a4f.zip
Only include actual trailing spaces not unused cells with capturep -J, from
George Nachman.
-rw-r--r--grid.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/grid.c b/grid.c
index 2955e8ba..5cc6c149 100644
--- a/grid.c
+++ b/grid.c
@@ -592,6 +592,7 @@ grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx,
char *buf, code[128];
size_t len, off, size, codelen;
u_int xx;
+ const struct grid_line *gl;
GRID_DEBUG(gd, "px=%u, py=%u, nx=%u", px, py, nx);
@@ -604,8 +605,11 @@ grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx,
buf = xmalloc(len);
off = 0;
+ gl = grid_peek_line(gd, py);
for (xx = px; xx < px + nx; xx++) {
- gc = grid_peek_cell(gd, xx, py);
+ if (gl == NULL || xx >= gl->cellsize)
+ break;
+ gc = &gl->celldata[xx];
if (gc->flags & GRID_FLAG_PADDING)
continue;
grid_cell_get(gc, &ud);