From 60c34ebb2da2b9716169ae4e6db4816d02c28910 Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Sat, 25 Apr 2020 15:18:04 -0700 Subject: 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. --- sys/src/cmd/acme/dat.h | 2 +- sys/src/cmd/acme/text.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'sys/src/cmd/acme') 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]; -- cgit v1.2.3