]> git.armaanb.net Git - st.git/commitdiff
selnormalize: make special case explicit
authornoname <noname@inventati.org>
Thu, 30 Apr 2015 19:59:24 +0000 (19:59 +0000)
committerRoberto E. Vargas Caballero <k0ga@shike2.com>
Mon, 4 May 2015 09:47:53 +0000 (11:47 +0200)
Special case is when regular selection spans multiple lines.
Otherwise, just sort sel.ob.x and sel.ob.y.

st.c

diff --git a/st.c b/st.c
index 789e79585bfd5837e867db038777d9b3493d3639..61388177c25b58d47995b023d4f981a7d7e58e31 100644 (file)
--- a/st.c
+++ b/st.c
@@ -685,12 +685,12 @@ void
 selnormalize(void) {
        int i;
 
-       if(sel.ob.y == sel.oe.y || sel.type == SEL_RECTANGULAR) {
-               sel.nb.x = MIN(sel.ob.x, sel.oe.x);
-               sel.ne.x = MAX(sel.ob.x, sel.oe.x);
-       } else {
+       if(sel.type == SEL_REGULAR && sel.ob.y != sel.oe.y) {
                sel.nb.x = sel.ob.y < sel.oe.y ? sel.ob.x : sel.oe.x;
                sel.ne.x = sel.ob.y < sel.oe.y ? sel.oe.x : sel.ob.x;
+       } else {
+               sel.nb.x = MIN(sel.ob.x, sel.oe.x);
+               sel.ne.x = MAX(sel.ob.x, sel.oe.x);
        }
        sel.nb.y = MIN(sel.ob.y, sel.oe.y);
        sel.ne.y = MAX(sel.ob.y, sel.oe.y);