diff options
author | Ori Bernstein <ori@eigenstate.org> | 2020-04-25 15:18:04 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2020-04-25 15:18:04 -0700 |
commit | 60c34ebb2da2b9716169ae4e6db4816d02c28910 (patch) | |
tree | 068829c43c50fd7a7a489cebb11bf8706325741d /sys/src/cmd/acme/text.c | |
parent | 7feab4dc5913c8d072d57e9cc7cc7b3815037fe8 (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/text.c')
-rw-r--r-- | sys/src/cmd/acme/text.c | 10 |
1 files changed, 6 insertions, 4 deletions
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]; |