diff options
author | Aurélien Aptel <aurelien.aptel@gmail.com> | 2011-11-01 16:33:43 +0100 |
---|---|---|
committer | Aurélien Aptel <aurelien.aptel@gmail.com> | 2011-11-01 16:33:43 +0100 |
commit | 5ca0d3d2fa34963d01c415a7ff9cd9a7b9033298 (patch) | |
tree | ccbadfaafebf2665192134300bfb223fef4a3c38 | |
parent | 44c83397afcd941f0e7820831aaee36088149530 (diff) | |
download | st-patched-5ca0d3d2fa34963d01c415a7ff9cd9a7b9033298.tar.bz2 st-patched-5ca0d3d2fa34963d01c415a7ff9cd9a7b9033298.tar.xz st-patched-5ca0d3d2fa34963d01c415a7ff9cd9a7b9033298.zip |
fix selection. (thx Tarmo Heiskanen)
-rw-r--r-- | st.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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 | } |