Skip to content

Commit 3d3df99

Browse files
committed
sync
1 parent 260c45a commit 3d3df99

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

st.c

+17-14
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
#define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b))
7474
#define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
7575
#define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || (a).bg != (b).bg)
76-
#define IS_SET(flag) (term.mode & (flag))
76+
#define IS_SET(flag) ((term.mode & (flag)) != 0)
7777
#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + (t1.tv_usec-t2.tv_usec)/1000)
7878

7979
#define VT102ID "\033[?6c"
@@ -624,6 +624,8 @@ selected(int x, int y) {
624624

625625
void
626626
getbuttoninfo(XEvent *e) {
627+
sel.alt = IS_SET(MODE_ALTSCREEN);
628+
627629
sel.ex = x2col(e->xbutton.x);
628630
sel.ey = y2row(e->xbutton.y);
629631

@@ -722,7 +724,6 @@ selcopy(void) {
722724
}
723725
*ptr = 0;
724726
}
725-
sel.alt = IS_SET(MODE_ALTSCREEN);
726727
xsetsel(str);
727728
}
728729

@@ -869,16 +870,17 @@ bmotion(XEvent *e) {
869870
return;
870871
}
871872

872-
if(sel.mode) {
873-
oldey = sel.ey;
874-
oldex = sel.ex;
875-
getbuttoninfo(e);
873+
if(!sel.mode)
874+
return;
876875

877-
if(oldey != sel.ey || oldex != sel.ex) {
878-
starty = MIN(oldey, sel.ey);
879-
endy = MAX(oldey, sel.ey);
880-
tsetdirt(starty, endy);
881-
}
876+
oldey = sel.ey;
877+
oldex = sel.ex;
878+
getbuttoninfo(e);
879+
880+
if(oldey != sel.ey || oldex != sel.ex) {
881+
starty = MIN(oldey, sel.ey);
882+
endy = MAX(oldey, sel.ey);
883+
tsetdirt(starty, endy);
882884
}
883885
}
884886

@@ -1510,7 +1512,7 @@ tsetmode(bool priv, bool set, int *args, int narg) {
15101512
case 1049: /* = 1047 and 1048 */
15111513
case 47:
15121514
case 1047: {
1513-
alt = IS_SET(MODE_ALTSCREEN) != 0;
1515+
alt = IS_SET(MODE_ALTSCREEN);
15141516
if(alt)
15151517
tclearregion(0, 0, term.col-1, term.row-1);
15161518
if(set ^ alt) /* set is always 1 or 0 */
@@ -2603,10 +2605,11 @@ drawregion(int x1, int y1, int x2, int y2) {
26032605
int ic, ib, x, y, ox, sl;
26042606
Glyph base, new;
26052607
char buf[DRAW_BUF_SIZ];
2606-
bool ena_sel = sel.bx != -1, alt = IS_SET(MODE_ALTSCREEN) != 0;
2608+
bool ena_sel = sel.bx != -1;
26072609

2608-
if((sel.alt != 0) ^ alt)
2610+
if(sel.alt ^ IS_SET(MODE_ALTSCREEN))
26092611
ena_sel = 0;
2612+
26102613
if(!(xw.state & WIN_VISIBLE))
26112614
return;
26122615

0 commit comments

Comments
 (0)