Introduction
Introduction Statistics Contact Development Disclaimer Help
tSimplify selected(). - st - [fork] customized build of st, the simple terminal
git clone git://src.adamsgaard.dk/st
Log
Files
Refs
README
LICENSE
---
commit 5f91983541014d34274087dbf723b48551f90fc0
parent 9e3e8ce4661d31629f9d4862467b2fb21c628e38
Author: noname <[email protected]>
Date: Sun, 27 Apr 2014 15:16:41 +0400
Simplify selected().
Diffstat:
M st.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/st.c b/st.c
t@@ -674,18 +674,13 @@ selsort(void) {
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.x);
+ if(sel.type == SEL_RECTANGULAR)
+ return BETWEEN(y, sel.nb.y, sel.ne.y)
+ && BETWEEN(x, sel.nb.x, sel.ne.x);
- if(sel.type == SEL_RECTANGULAR) {
- return ((sel.nb.y <= y && y <= sel.ne.y)
- && (sel.nb.x <= x && x <= sel.ne.x));
- }
-
- return ((sel.nb.y < y && y < sel.ne.y)
- || (y == sel.ne.y && x <= sel.ne.x))
- || (y == sel.nb.y && x >= sel.nb.x
- && (x <= sel.ne.x || sel.nb.y != sel.ne.y));
+ return BETWEEN(y, sel.nb.y, sel.ne.y)
+ && (y != sel.nb.y || x >= sel.nb.x)
+ && (y != sel.ne.y || x <= sel.ne.x);
}
void
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.