aboutsummaryrefslogtreecommitdiff
path: root/window-copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'window-copy.c')
-rw-r--r--window-copy.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/window-copy.c b/window-copy.c
index 26a54f4c..5aff70ff 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -522,7 +522,15 @@ window_copy_find_length(struct window_pane *wp, u_int py)
const struct grid_cell *gc;
u_int px;
+ /*
+ * If the pane has been resized, its grid can contain old overlong
+ * lines. grid_peek_cell does not allow accessing cells beyond the
+ * width of the grid, and screen_write_copy treats them as spaces, so
+ * ignore them here too.
+ */
px = wp->base.grid->size[py];
+ if (px > screen_size_x(&wp->base))
+ px = screen_size_x(&wp->base);
while (px > 0) {
gc = grid_peek_cell(wp->base.grid, px - 1, py);
if (gc->flags & GRID_FLAG_UTF8)