diff options
| author | noname <noname@inventati.org> | 2015-04-30 19:59:24 +0000 |
|---|---|---|
| committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2015-05-04 11:47:53 +0200 |
| commit | 22571ea4e8729efee6940b704666566b46e42e76 (patch) | |
| tree | b7abcc2523e3034dc8b64764f005e54656512e14 | |
| parent | 8751809aff596fc2030026713651c11b3743f88e (diff) | |
| download | st-22571ea4e8729efee6940b704666566b46e42e76.tar.gz st-22571ea4e8729efee6940b704666566b46e42e76.zip | |
selnormalize: make special case explicit
Special case is when regular selection spans multiple lines.
Otherwise, just sort sel.ob.x and sel.ob.y.
| -rw-r--r-- | st.c | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -685,12 +685,12 @@ void | |||
| 685 | selnormalize(void) { | 685 | selnormalize(void) { |
| 686 | int i; | 686 | int i; |
| 687 | 687 | ||
| 688 | if(sel.ob.y == sel.oe.y || sel.type == SEL_RECTANGULAR) { | 688 | if(sel.type == SEL_REGULAR && sel.ob.y != sel.oe.y) { |
| 689 | sel.nb.x = MIN(sel.ob.x, sel.oe.x); | ||
| 690 | sel.ne.x = MAX(sel.ob.x, sel.oe.x); | ||
| 691 | } else { | ||
| 692 | sel.nb.x = sel.ob.y < sel.oe.y ? sel.ob.x : sel.oe.x; | 689 | sel.nb.x = sel.ob.y < sel.oe.y ? sel.ob.x : sel.oe.x; |
| 693 | sel.ne.x = sel.ob.y < sel.oe.y ? sel.oe.x : sel.ob.x; | 690 | sel.ne.x = sel.ob.y < sel.oe.y ? sel.oe.x : sel.ob.x; |
| 691 | } else { | ||
| 692 | sel.nb.x = MIN(sel.ob.x, sel.oe.x); | ||
| 693 | sel.ne.x = MAX(sel.ob.x, sel.oe.x); | ||
| 694 | } | 694 | } |
| 695 | sel.nb.y = MIN(sel.ob.y, sel.oe.y); | 695 | sel.nb.y = MIN(sel.ob.y, sel.oe.y); |
| 696 | sel.ne.y = MAX(sel.ob.y, sel.oe.y); | 696 | sel.ne.y = MAX(sel.ob.y, sel.oe.y); |
