I was confused by this complex block for a few moments before managing
to parse "rest start x", "last end x", etc.  This may or may not help
the next reader of this code but I think it's undoubtedly simpler.

Keith

---
 window-copy.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/window-copy.c b/window-copy.c
index 508001d34d61..69a3e13b8bbd 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -1429,18 +1429,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. */
        if (off == 0) {
-- 
1.9.1


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to