billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=90d3bf483cb4abebc32554fbc8e3bc8ccadd3a27

commit 90d3bf483cb4abebc32554fbc8e3bc8ccadd3a27
Author: Boris Faure <bill...@gmail.com>
Date:   Sun Nov 3 18:43:07 2013 +0100

    fix stretching selection
---
 src/bin/termio.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/src/bin/termio.c b/src/bin/termio.c
index b3aafce..368b2b1 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -3072,8 +3072,55 @@ _smart_cb_mouse_down(void *data, Evas *e EINA_UNUSED, 
Evas_Object *obj EINA_UNUS
              if (sd->pty->selection.is_active &&
                  (sd->top_left || sd->bottom_right))
                {
+                  /* stretch selection */
+                  int start_x, start_y, end_x, end_y;
+
+                  start_x = sd->pty->selection.start.x;
+                  start_y = sd->pty->selection.start.y;
+                  end_x   = sd->pty->selection.end.x;
+                  end_y   = sd->pty->selection.end.y;
                   _sel_set(data, EINA_TRUE);
                   sd->pty->selection.makesel = EINA_TRUE;
+                  if (sd->pty->selection.is_box)
+                    {
+                       if (sd->top_left)
+                         {
+                            if (start_y < end_y)
+                              INT_SWAP(start_y, end_y);
+                            if (start_x < end_x)
+                              INT_SWAP(start_x, end_x);
+                         }
+                       else
+                         {
+                            if (start_y > end_y)
+                              INT_SWAP(start_y, end_y);
+                            if (start_x > end_x)
+                              INT_SWAP(start_x, end_x);
+                         }
+                    }
+                  else
+                    {
+                       if (sd->top_left)
+                         {
+                            if ((start_y < end_y) ||
+                                ((start_y == end_y) && (end_x > start_x)))
+                              {
+                                 INT_SWAP(start_y, end_y);
+                                 INT_SWAP(start_x, end_x);
+                              }
+                         }
+                       else
+                         {
+                            if ((start_y > end_y) ||
+                                ((start_y == end_y) && (end_x < start_x)))
+                              {
+                                 INT_SWAP(start_y, end_y);
+                                 INT_SWAP(start_x, end_x);
+                              }
+                         }
+                    }
+                  sd->pty->selection.start.x = start_x;
+                  sd->pty->selection.start.y = start_y;
                   sd->pty->selection.end.x = cx;
                   sd->pty->selection.end.y = cy - sd->scroll;
                   _selection_dbl_fix(data);

-- 


Reply via email to