Fixing the selection in a single line again.
Thanks p37sitdu@lavabit.com!
This commit is contained in:
		
							
								
								
									
										9
									
								
								st.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								st.c
									
									
									
									
									
								
							| @@ -667,16 +667,21 @@ y2row(int y) { | |||||||
|  |  | ||||||
| static void | static void | ||||||
| selsort(void) { | selsort(void) { | ||||||
|  | 	if(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.nb.y = MIN(sel.ob.y, sel.oe.y); |  | ||||||
| 		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; | ||||||
|  | 	} | ||||||
|  | 	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); | ||||||
| } | } | ||||||
|  |  | ||||||
| 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.ne.y == y && sel.nb.y == y) | ||||||
| 		return BETWEEN(x, sel.nb.x, sel.ne.y); | 		return BETWEEN(x, sel.nb.x, sel.ne.x); | ||||||
|  |  | ||||||
| 	if(sel.type == SEL_RECTANGULAR) { | 	if(sel.type == SEL_RECTANGULAR) { | ||||||
| 		return ((sel.nb.y <= y && y <= sel.ne.y) | 		return ((sel.nb.y <= y && y <= sel.ne.y) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user