aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'st.c')
-rw-r--r--st.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/st.c b/st.c
index 46f6d5b..e193443 100644
--- a/st.c
+++ b/st.c
@@ -463,6 +463,9 @@ bpress(XEvent *e) {
463 if(IS_SET(MODE_MOUSE)) 463 if(IS_SET(MODE_MOUSE))
464 mousereport(e); 464 mousereport(e);
465 else if(e->xbutton.button == Button1) { 465 else if(e->xbutton.button == Button1) {
466 if(sel.bx != -1)
467 for(int i=sel.b.y; i<=sel.e.y; i++)
468 term.dirty[i] = 1;
466 sel.mode = 1; 469 sel.mode = 1;
467 sel.ex = sel.bx = X2COL(e->xbutton.x); 470 sel.ex = sel.bx = X2COL(e->xbutton.x);
468 sel.ey = sel.by = Y2ROW(e->xbutton.y); 471 sel.ey = sel.by = Y2ROW(e->xbutton.y);
@@ -583,6 +586,7 @@ brelease(XEvent *e) {
583 else if(e->xbutton.button == Button1) { 586 else if(e->xbutton.button == Button1) {
584 sel.mode = 0; 587 sel.mode = 0;
585 getbuttoninfo(e, NULL, &sel.ex, &sel.ey); 588 getbuttoninfo(e, NULL, &sel.ex, &sel.ey);
589 term.dirty[sel.ey] = 1;
586 if(sel.bx == sel.ex && sel.by == sel.ey) { 590 if(sel.bx == sel.ex && sel.by == sel.ey) {
587 struct timeval now; 591 struct timeval now;
588 sel.bx = -1; 592 sel.bx = -1;
@@ -627,7 +631,9 @@ bmotion(XEvent *e) {
627 if(oldey != sel.ey || oldex != sel.ex) { 631 if(oldey != sel.ey || oldex != sel.ex) {
628 int starty = MIN(oldey, sel.ey); 632 int starty = MIN(oldey, sel.ey);
629 int endy = MAX(oldey, sel.ey); 633 int endy = MAX(oldey, sel.ey);
630 drawregion(0, (starty > 0 ? starty : 0), term.col, (endy < term.row ? endy+1 : term.row)); 634 for(int i=starty; i<=endy; i++)
635 term.dirty[i] = 1;
636 draw();
631 } 637 }
632 } 638 }
633} 639}
@@ -1855,7 +1861,7 @@ drawregion(int x1, int y1, int x2, int y2) {
1855 xdraws(buf, base, ox, y, ic, ib); 1861 xdraws(buf, base, ox, y, ic, ib);
1856 } 1862 }
1857 xdrawcursor(); 1863 xdrawcursor();
1858 XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, x1*xw.cw, y1*xw.ch, (x2-1)*xw.cw, (y2-1)*xw.ch, BORDER, BORDER); 1864 XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, x1*xw.cw, y1*xw.ch, x2*xw.cw, y2*xw.ch, BORDER, BORDER);
1859} 1865}
1860 1866
1861void 1867void