diff options
author | nicm <nicm> | 2013-10-10 11:49:29 +0000 |
---|---|---|
committer | nicm <nicm> | 2013-10-10 11:49:29 +0000 |
commit | 7839993fe734aec38355401ce5a02d85f9dab5ba (patch) | |
tree | c538e61e1ed66809abe6148d6ede434c7ce8e670 /grid.c | |
parent | 47a4a9992c59199bb55188c666eddce7895d884e (diff) |
Only include actual trailing spaces not unused cells with capturep -J,
from George Nachman.
Diffstat (limited to 'grid.c')
-rw-r--r-- | grid.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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); |