diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-05-14 06:39:59 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-05-14 06:39:59 +0000 |
commit | a6657c492ef8e001de086b055dcef7e1fa25f568 (patch) | |
tree | e9fb665b92bed39df0eabf61a26016f522c4e283 /usr.bin/tmux | |
parent | 1101cfc744496d5313389429488d8fd7773bfec6 (diff) |
Simplify copy lines, from Keith Amling.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/window-copy.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 8d36667ccfe..85510368c87 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.109 2014/05/13 07:54:20 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.110 2014/05/14 06:39:58 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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. */ |