aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'st.c')
-rw-r--r--st.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/st.c b/st.c
index 21cba9e..b7e215e 100644
--- a/st.c
+++ b/st.c
@@ -167,11 +167,11 @@ static ssize_t xwrite(int, const char *, size_t);
167 167
168/* Globals */ 168/* Globals */
169Term term; 169Term term;
170Selection sel;
171int cmdfd; 170int cmdfd;
172pid_t pid; 171pid_t pid;
173int oldbutton = 3; /* button event on startup: 3 = release */ 172int oldbutton = 3; /* button event on startup: 3 = release */
174 173
174static Selection sel;
175static CSIEscape csiescseq; 175static CSIEscape csiescseq;
176static STREscape strescseq; 176static STREscape strescseq;
177static int iofd = 1; 177static int iofd = 1;
@@ -402,9 +402,17 @@ selstart(int col, int row, int snap)
402} 402}
403 403
404void 404void
405selextend(int col, int row, int type) 405selextend(int col, int row, int type, int done)
406{ 406{
407 int oldey, oldex, oldsby, oldsey, oldtype; 407 int oldey, oldex, oldsby, oldsey, oldtype;
408
409 if (!sel.mode)
410 return;
411 if (done && sel.mode == SEL_EMPTY) {
412 selclear();
413 return;
414 }
415
408 oldey = sel.oe.y; 416 oldey = sel.oe.y;
409 oldex = sel.oe.x; 417 oldex = sel.oe.x;
410 oldsby = sel.nb.y; 418 oldsby = sel.nb.y;
@@ -419,6 +427,8 @@ selextend(int col, int row, int type)
419 427
420 if (oldey != sel.oe.y || oldex != sel.oe.x || oldtype != sel.type) 428 if (oldey != sel.oe.y || oldex != sel.oe.x || oldtype != sel.type)
421 tsetdirt(MIN(sel.nb.y, oldsby), MAX(sel.ne.y, oldsey)); 429 tsetdirt(MIN(sel.nb.y, oldsby), MAX(sel.ne.y, oldsey));
430
431 sel.mode = done ? SEL_IDLE : SEL_READY;
422} 432}
423 433
424void 434void