mirror of
https://github.com/alrayyes/st.git
synced 2024-11-25 20:36:23 +00:00
selnormalize: make special case explicit
Special case is when regular selection spans multiple lines. Otherwise, just sort sel.ob.x and sel.ob.y.
This commit is contained in:
parent
8751809aff
commit
22571ea4e8
1 changed files with 4 additions and 4 deletions
8
st.c
8
st.c
|
@ -685,12 +685,12 @@ void
|
||||||
selnormalize(void) {
|
selnormalize(void) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(sel.ob.y == sel.oe.y || sel.type == SEL_RECTANGULAR) {
|
if(sel.type == SEL_REGULAR && 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.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.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.nb.y = MIN(sel.ob.y, sel.oe.y);
|
||||||
sel.ne.y = MAX(sel.ob.y, sel.oe.y);
|
sel.ne.y = MAX(sel.ob.y, sel.oe.y);
|
||||||
|
|
Loading…
Reference in a new issue