summaryrefslogtreecommitdiff
path: root/sys/src/cmd/acme
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/acme
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/acme')
-rw-r--r--sys/src/cmd/acme/dat.h2
-rw-r--r--sys/src/cmd/acme/text.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/sys/src/cmd/acme/dat.h b/sys/src/cmd/acme/dat.h
index 9e8fe26ec..100488c64 100644
--- a/sys/src/cmd/acme/dat.h
+++ b/sys/src/cmd/acme/dat.h
@@ -203,7 +203,7 @@ void textcolumnate(Text*, Dirlist**, int);
void textcommit(Text*, int);
void textconstrain(Text*, uint, uint, uint*, uint*);
void textdelete(Text*, uint, uint, int);
-void textstretchsel(Text*, uint*, uint*, int);
+void textstretchsel(Text*, uint, uint*, uint*, int);
void textfill(Text*);
void textframescroll(Text*, int);
void textinit(Text*, File*, Rectangle, Reffont*, Image**);
diff --git a/sys/src/cmd/acme/text.c b/sys/src/cmd/acme/text.c
index 1987644b2..9611a2e4b 100644
--- a/sys/src/cmd/acme/text.c
+++ b/sys/src/cmd/acme/text.c
@@ -932,7 +932,7 @@ textselect(Text *t)
if(mouse->msec-clickmsec >= 500 || selecttext != t || clickcount > 3)
clickcount = 0;
if(clickcount >= 1 && selecttext==t && mouse->msec-clickmsec < 500){
- textstretchsel(t, &q0, &q1, clickcount);
+ textstretchsel(t, selectq, &q0, &q1, clickcount);
textsetselect(t, q0, q1);
flushimage(display, 1);
x = mouse->xy.x;
@@ -951,7 +951,7 @@ textselect(Text *t)
mouse->xy.y = y;
q0 = t->q0; /* may have changed */
q1 = t->q1;
- selectq = q0;
+ selectq = t->org+frcharofpt(t, mouse->xy);;
}
if(mouse->buttons == b && clickcount == 0){
t->Frame.scroll = framescroll;
@@ -971,7 +971,7 @@ textselect(Text *t)
}
if(q0 == q1){
if(q0==t->q0 && mouse->msec-clickmsec<500)
- textstretchsel(t, &q0, &q1, clickcount);
+ textstretchsel(t, selectq, &q0, &q1, clickcount);
else
clicktext = t;
clickmsec = mouse->msec;
@@ -1304,12 +1304,14 @@ inmode(Rune r, int mode)
}
void
-textstretchsel(Text *t, uint *q0, uint *q1, int mode)
+textstretchsel(Text *t, uint mp, uint *q0, uint *q1, int mode)
{
int c, i;
Rune *r, *l, *p;
uint q;
+ *q0 = mp;
+ *q1 = mp;
for(i=0; left[i]!=nil; i++){
q = *q0;
l = left[i];