[hackers] [st] Fixing the selection in a single line again. || Christoph Lohmann

From: <git_AT_suckless.org>
Date: Sun, 26 May 2013 16:12:41 +0200

commit b5144100a59956b5bf69614a077bd4d252d7dc6c
Author: Christoph Lohmann <20h_AT_r-36.net>
Date: Sun May 26 16:10:22 2013 +0200

    Fixing the selection in a single line again.
    
    Thanks p37sitdu_AT_lavabit.com!

diff --git a/st.c b/st.c
index 826f745..2eb007b 100644
--- a/st.c
+++ b/st.c
_AT_@ -667,16 +667,21 @@ y2row(int y) {
 
 static void
 selsort(void) {
- sel.nb.x = sel.ob.y < sel.oe.y ? sel.ob.x : sel.oe.x;
+ if(sel.ob.y == sel.oe.y) {
+ sel.nb.x = MIN(sel.ob.x, sel.oe.x);
+ sel.ne.x = MAX(sel.ob.x, sel.oe.x);
+ } else {
+ 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;
+ }
         sel.nb.y = MIN(sel.ob.y, sel.oe.y);
- sel.ne.x = sel.ob.y < sel.oe.y ? sel.oe.x : sel.ob.x;
         sel.ne.y = MAX(sel.ob.y, sel.oe.y);
 }
 
 static inline bool
 selected(int x, int y) {
         if(sel.ne.y == y && sel.nb.y == y)
- return BETWEEN(x, sel.nb.x, sel.ne.y);
+ return BETWEEN(x, sel.nb.x, sel.ne.x);
 
         if(sel.type == SEL_RECTANGULAR) {
                 return ((sel.nb.y <= y && y <= sel.ne.y)
Received on Sun May 26 2013 - 16:12:41 CEST

This archive was generated by hypermail 2.3.0 : Sun May 26 2013 - 16:24:12 CEST