diff options
Diffstat (limited to 'st.c')
| -rw-r--r-- | st.c | 17 |
1 files changed, 6 insertions, 11 deletions
| @@ -674,18 +674,13 @@ selsort(void) { | |||
| 674 | 674 | ||
| 675 | static inline bool | 675 | static inline bool |
| 676 | selected(int x, int y) { | 676 | selected(int x, int y) { |
| 677 | if(sel.ne.y == y && sel.nb.y == y) | 677 | if(sel.type == SEL_RECTANGULAR) |
| 678 | return BETWEEN(x, sel.nb.x, sel.ne.x); | 678 | return BETWEEN(y, sel.nb.y, sel.ne.y) |
| 679 | && BETWEEN(x, sel.nb.x, sel.ne.x); | ||
| 679 | 680 | ||
| 680 | if(sel.type == SEL_RECTANGULAR) { | 681 | return BETWEEN(y, sel.nb.y, sel.ne.y) |
| 681 | return ((sel.nb.y <= y && y <= sel.ne.y) | 682 | && (y != sel.nb.y || x >= sel.nb.x) |
| 682 | && (sel.nb.x <= x && x <= sel.ne.x)); | 683 | && (y != sel.ne.y || x <= sel.ne.x); |
| 683 | } | ||
| 684 | |||
| 685 | return ((sel.nb.y < y && y < sel.ne.y) | ||
| 686 | || (y == sel.ne.y && x <= sel.ne.x)) | ||
| 687 | || (y == sel.nb.y && x >= sel.nb.x | ||
| 688 | && (x <= sel.ne.x || sel.nb.y != sel.ne.y)); | ||
| 689 | } | 684 | } |
| 690 | 685 | ||
| 691 | void | 686 | void |
