diff options
author | nicm <nicm> | 2014-05-14 06:39:58 +0000 |
---|---|---|
committer | nicm <nicm> | 2014-05-14 06:39:58 +0000 |
commit | 58c97695c9516ae2d95e1f26c8fa2539fece862a (patch) | |
tree | b280b330cc5ebb484652af7cdad9c6145cdd8b6d /window-copy.c | |
parent | 53cbae544f79daede0f9457f31947f5d001ac788 (diff) |
Simplify copy lines, from Keith Amling.
Diffstat (limited to 'window-copy.c')
-rw-r--r-- | window-copy.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/window-copy.c b/window-copy.c index aa6b2d73..1d603353 100644 --- a/window-copy.c +++ b/window-copy.c @@ -1442,17 +1442,10 @@ window_copy_get_selection(struct window_pane *wp, size_t *len) } /* Copy the lines. */ - if (sy == ey) - window_copy_copy_line(wp, &buf, &off, sy, firstsx, lastex); - else { - window_copy_copy_line(wp, &buf, &off, sy, firstsx, restex); - if (ey - sy > 1) { - for (i = sy + 1; i < ey; i++) { - window_copy_copy_line( - wp, &buf, &off, i, restsx, restex); - } - } - window_copy_copy_line(wp, &buf, &off, ey, restsx, lastex); + for (i = sy; i <= ey; i++) { + window_copy_copy_line(wp, &buf, &off, i, + (i == sy ? firstsx : restsx), + (i == ey ? lastex : restex)); } /* Don't bother if no data. */ |