mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-06 22:12:47 -05:00
terminal.[ch]: refactor the 'pos' macros.
These are now inline functions (mostly, except for a couple of macro wrappers to preserve the old call syntax), and they live in terminal.h instead of at the top of terminal.c. Also, I've added a few comments for clarity, and renamed the posPlt() function, which didn't do at all what the name made it look (at least to a mathematician familiar with product orders) as if it did.
This commit is contained in:
18
terminal.c
18
terminal.c
@ -13,22 +13,6 @@
|
||||
#include "putty.h"
|
||||
#include "terminal.h"
|
||||
|
||||
#define poslt(p1,p2) ( (p1).y < (p2).y || ( (p1).y == (p2).y && (p1).x < (p2).x ) )
|
||||
#define posle(p1,p2) ( (p1).y < (p2).y || ( (p1).y == (p2).y && (p1).x <= (p2).x ) )
|
||||
#define poseq(p1,p2) ( (p1).y == (p2).y && (p1).x == (p2).x )
|
||||
#define posdiff(p1,p2) ( ((p1).y - (p2).y) * (term->cols+1) + (p1).x - (p2).x )
|
||||
|
||||
/* Product-order comparisons for rectangular block selection. */
|
||||
#define posPlt(p1,p2) ( (p1).y <= (p2).y && (p1).x < (p2).x )
|
||||
#define posPle(p1,p2) ( (p1).y <= (p2).y && (p1).x <= (p2).x )
|
||||
|
||||
#define incpos(p) ( (p).x == term->cols ? \
|
||||
((p).x = 0, (p).y++, true) : \
|
||||
((p).x++, false) )
|
||||
#define decpos(p) ( (p).x == 0 ? \
|
||||
((p).x = term->cols, (p).y--, true) : \
|
||||
((p).x--, false) )
|
||||
|
||||
#define VT52_PLUS
|
||||
|
||||
#define CL_ANSIMIN 0x0001 /* Codes in all ANSI like terminals. */
|
||||
@ -5492,7 +5476,7 @@ static void do_paint(Terminal *term)
|
||||
poslt(scrpos, term->selend));
|
||||
else
|
||||
selected = (posPle(term->selstart, scrpos) &&
|
||||
posPlt(scrpos, term->selend));
|
||||
posPle_left(scrpos, term->selend));
|
||||
} else
|
||||
selected = false;
|
||||
tattr = (tattr ^ rv
|
||||
|
Reference in New Issue
Block a user