mirror of
https://github.com/LukeSmithxyz/st.git
synced 2024-11-25 16:35:46 +01:00
Simplify selected().
This commit is contained in:
parent
9e3e8ce466
commit
5f91983541
1 changed files with 6 additions and 11 deletions
17
st.c
17
st.c
|
@ -674,18 +674,13 @@ selsort(void) {
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
selected(int x, int y) {
|
selected(int x, int y) {
|
||||||
if(sel.ne.y == y && sel.nb.y == y)
|
if(sel.type == SEL_RECTANGULAR)
|
||||||
return BETWEEN(x, sel.nb.x, sel.ne.x);
|
return BETWEEN(y, sel.nb.y, sel.ne.y)
|
||||||
|
&& BETWEEN(x, sel.nb.x, sel.ne.x);
|
||||||
|
|
||||||
if(sel.type == SEL_RECTANGULAR) {
|
return BETWEEN(y, sel.nb.y, sel.ne.y)
|
||||||
return ((sel.nb.y <= y && y <= sel.ne.y)
|
&& (y != sel.nb.y || x >= sel.nb.x)
|
||||||
&& (sel.nb.x <= x && x <= sel.ne.x));
|
&& (y != sel.ne.y || 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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue