summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window-copy.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2018-07-04 09:44:08 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2018-07-04 09:44:08 +0000
commit56d236785884b00a6cbe5e301286e8a4c27f9041 (patch)
tree89393b082b1e14e5d75618bfd84f16bc0f36696d /usr.bin/tmux/window-copy.c
parentfd6585f9bdc09566dea7fb6f20413f6ee5d23d1a (diff)
Add accessors for grid linedata member, for some future work. From Dan
Aloni.
Diffstat (limited to 'usr.bin/tmux/window-copy.c')
-rw-r--r--usr.bin/tmux/window-copy.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index e1aeb93e325..5dd90069f94 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.189 2018/06/26 11:14:05 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.190 2018/07/04 09:44:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1755,7 +1755,7 @@ window_copy_copy_line(struct window_pane *wp, char **buf, size_t *off, u_int sy,
* Work out if the line was wrapped at the screen edge and all of it is
* on screen.
*/
- gl = &gd->linedata[sy];
+ gl = grid_get_line(gd, sy);
if (gl->flags & GRID_LINE_WRAPPED && gl->cellsize <= gd->sx)
wrapped = 1;
@@ -1843,7 +1843,7 @@ window_copy_find_length(struct window_pane *wp, u_int py)
* width of the grid, and screen_write_copy treats them as spaces, so
* ignore them here too.
*/
- px = s->grid->linedata[py].cellsize;
+ px = grid_get_line(s->grid, py)->cellsize;
if (px > screen_size_x(s))
px = screen_size_x(s);
while (px > 0) {
@@ -1867,7 +1867,7 @@ window_copy_cursor_start_of_line(struct window_pane *wp)
if (data->cx == 0 && s->sel.lineflag == LINE_SEL_NONE) {
py = screen_hsize(back_s) + data->cy - data->oy;
while (py > 0 &&
- gd->linedata[py-1].flags & GRID_LINE_WRAPPED) {
+ grid_get_line(gd, py - 1)->flags & GRID_LINE_WRAPPED) {
window_copy_cursor_up(wp, 0);
py = screen_hsize(back_s) + data->cy - data->oy;
}
@@ -1907,6 +1907,7 @@ window_copy_cursor_end_of_line(struct window_pane *wp)
struct screen *back_s = data->backing;
struct screen *s = &data->screen;
struct grid *gd = back_s->grid;
+ struct grid_line *gl;
u_int px, py;
py = screen_hsize(back_s) + data->cy - data->oy;
@@ -1915,12 +1916,14 @@ window_copy_cursor_end_of_line(struct window_pane *wp)
if (data->cx == px && s->sel.lineflag == LINE_SEL_NONE) {
if (data->screen.sel.flag && data->rectflag)
px = screen_size_x(back_s);
- if (gd->linedata[py].flags & GRID_LINE_WRAPPED) {
- while (py < gd->sy + gd->hsize &&
- gd->linedata[py].flags & GRID_LINE_WRAPPED) {
+ gl = grid_get_line(gd, py);
+ if (gl->flags & GRID_LINE_WRAPPED) {
+ while (py < gd->sy + gd->hsize) {
+ gl = grid_get_line(gd, py);
+ if (~gl->flags & GRID_LINE_WRAPPED)
+ break;
window_copy_cursor_down(wp, 0);
- py = screen_hsize(back_s)
- + data->cy - data->oy;
+ py = screen_hsize(back_s) + data->cy - data->oy;
}
px = window_copy_find_length(wp, py);
}