summaryrefslogtreecommitdiff
path: root/sys/src/cmd/rio
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2020-04-25 15:18:04 -0700
committerOri Bernstein <ori@eigenstate.org>2020-04-25 15:18:04 -0700
commit60c34ebb2da2b9716169ae4e6db4816d02c28910 (patch)
tree068829c43c50fd7a7a489cebb11bf8706325741d /sys/src/cmd/rio
parent7feab4dc5913c8d072d57e9cc7cc7b3815037fe8 (diff)
tweak selection criteria
grow selection from point of click, not start of selection region. starting at the beginning of the selection region causes the match logic to kick in, which is confusing.
Diffstat (limited to 'sys/src/cmd/rio')
-rw-r--r--sys/src/cmd/rio/dat.h2
-rw-r--r--sys/src/cmd/rio/wind.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/sys/src/cmd/rio/dat.h b/sys/src/cmd/rio/dat.h
index 324698f7b..8ae7e41e2 100644
--- a/sys/src/cmd/rio/dat.h
+++ b/sys/src/cmd/rio/dat.h
@@ -195,7 +195,7 @@ void wclosewin(Window*);
void wcurrent(Window*);
void wcut(Window*);
void wdelete(Window*, uint, uint);
-void wstretchsel(Window*, uint*, uint*, int);
+void wstretchsel(Window*, uint, uint*, uint*, int);
void wfill(Window*);
void wframescroll(Window*, int);
void wkeyctl(Window*, Rune);
diff --git a/sys/src/cmd/rio/wind.c b/sys/src/cmd/rio/wind.c
index 2a5e065bf..a9cfd248e 100644
--- a/sys/src/cmd/rio/wind.c
+++ b/sys/src/cmd/rio/wind.c
@@ -1024,7 +1024,7 @@ wselect(Window *w)
clickcount = 0;
if(clickwin == w && clickcount >= 1 && w->mc.msec-clickmsec < 500){
mode = (clickcount > 2) ? 2 : clickcount;
- wstretchsel(w, &q0, &q1, mode);
+ wstretchsel(w, selectq, &q0, &q1, mode);
wsetselect(w, q0, q1);
x = w->mc.xy.x;
y = w->mc.xy.y;
@@ -1042,7 +1042,7 @@ wselect(Window *w)
w->mc.xy.y = y;
q0 = w->q0; /* may have changed */
q1 = w->q1;
- selectq = q0;
+ selectq = w->org+frcharofpt(w, w->mc.xy);
}
if(w->mc.buttons == b && clickcount == 0){
w->scroll = framescroll;
@@ -1063,7 +1063,7 @@ wselect(Window *w)
if(q0 == q1){
mode = (clickcount > 2) ? 2 : clickcount;
if(q0==w->q0 && clickwin==w && w->mc.msec-clickmsec<500)
- wstretchsel(w, &q0, &q1, mode);
+ wstretchsel(w, selectq, &q0, &q1, mode);
else
clickwin = w;
clickmsec = w->mc.msec;
@@ -1499,12 +1499,14 @@ inmode(Rune r, int mode)
}
void
-wstretchsel(Window *w, uint *q0, uint *q1, int mode)
+wstretchsel(Window *w, uint pt, uint *q0, uint *q1, int mode)
{
int c, i;
Rune *r, *l, *p;
uint q;
+ *q0 = pt;
+ *q1 = pt;
for(i=0; left[i]!=nil; i++){
q = *q0;
l = left[i];