mirror of
https://github.com/alrayyes/st.git
synced 2024-11-25 20:36:23 +00:00
fix selection. (thx Tarmo Heiskanen)
This commit is contained in:
parent
0dbf9c8c12
commit
a20125a3d1
1 changed files with 7 additions and 1 deletions
8
st.c
8
st.c
|
@ -463,6 +463,9 @@ bpress(XEvent *e) {
|
||||||
if(IS_SET(MODE_MOUSE))
|
if(IS_SET(MODE_MOUSE))
|
||||||
mousereport(e);
|
mousereport(e);
|
||||||
else if(e->xbutton.button == Button1) {
|
else if(e->xbutton.button == Button1) {
|
||||||
|
if(sel.bx != -1)
|
||||||
|
for(int i=sel.b.y; i<=sel.e.y; i++)
|
||||||
|
term.dirty[i] = 1;
|
||||||
sel.mode = 1;
|
sel.mode = 1;
|
||||||
sel.ex = sel.bx = X2COL(e->xbutton.x);
|
sel.ex = sel.bx = X2COL(e->xbutton.x);
|
||||||
sel.ey = sel.by = Y2ROW(e->xbutton.y);
|
sel.ey = sel.by = Y2ROW(e->xbutton.y);
|
||||||
|
@ -583,6 +586,7 @@ brelease(XEvent *e) {
|
||||||
else if(e->xbutton.button == Button1) {
|
else if(e->xbutton.button == Button1) {
|
||||||
sel.mode = 0;
|
sel.mode = 0;
|
||||||
getbuttoninfo(e, NULL, &sel.ex, &sel.ey);
|
getbuttoninfo(e, NULL, &sel.ex, &sel.ey);
|
||||||
|
term.dirty[sel.ey] = 1;
|
||||||
if(sel.bx == sel.ex && sel.by == sel.ey) {
|
if(sel.bx == sel.ex && sel.by == sel.ey) {
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
sel.bx = -1;
|
sel.bx = -1;
|
||||||
|
@ -627,7 +631,9 @@ bmotion(XEvent *e) {
|
||||||
if(oldey != sel.ey || oldex != sel.ex) {
|
if(oldey != sel.ey || oldex != sel.ex) {
|
||||||
int starty = MIN(oldey, sel.ey);
|
int starty = MIN(oldey, sel.ey);
|
||||||
int endy = MAX(oldey, sel.ey);
|
int endy = MAX(oldey, sel.ey);
|
||||||
drawregion(0, (starty > 0 ? starty : 0), term.col, (endy < term.row ? endy+1 : term.row));
|
for(int i=starty; i<=endy; i++)
|
||||||
|
term.dirty[i] = 1;
|
||||||
|
draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue