commit 53b609386d58d7048e5b9e62d23b1a7b05b30e1b
parent 2d2c69ea629dff17573f7c935c4453e7a0058e80
Author: Giygas <none>
Date: Thu, 2 Jan 2025 21:35:14 -0800
warp pointer to relative character, not absolute
Diffstat:
M | patch-acme3k | | | 66 | ++++++++++++++++++++++++++++++++++++------------------------------ |
1 file changed, 36 insertions(+), 30 deletions(-)
diff --git a/patch-acme3k b/patch-acme3k
@@ -1,6 +1,6 @@
diff -u a/src/cmd/acme/acme.c b/src/cmd/acme/acme.c
---- a/src/cmd/acme/acme.c Mon Dec 30 04:46:36 2024
-+++ b/src/cmd/acme/acme.c Mon Dec 30 04:40:45 2024
+--- a/src/cmd/acme/acme.c Thu Jan 2 21:32:59 2025
++++ b/src/cmd/acme/acme.c Thu Jan 2 21:33:09 2025
@@ -11,6 +11,7 @@
#include <libsec.h>
#include "dat.h"
@@ -86,8 +86,8 @@ diff -u a/src/cmd/acme/acme.c b/src/cmd/acme/acme.c
/*
diff -u a/src/cmd/acme/cols.c b/src/cmd/acme/cols.c
---- a/src/cmd/acme/cols.c Mon Dec 30 04:46:36 2024
-+++ b/src/cmd/acme/cols.c Mon Dec 30 04:40:45 2024
+--- a/src/cmd/acme/cols.c Thu Jan 2 21:32:59 2025
++++ b/src/cmd/acme/cols.c Thu Jan 2 21:33:09 2025
@@ -29,7 +29,7 @@
Rectangle r1;
Text *t;
@@ -190,8 +190,8 @@ diff -u a/src/cmd/acme/cols.c b/src/cmd/acme/cols.c
Only in b/src/cmd/acme: config.def.h
Only in b/src/cmd/acme: config.h
diff -u a/src/cmd/acme/dat.h b/src/cmd/acme/dat.h
---- a/src/cmd/acme/dat.h Mon Dec 30 04:46:36 2024
-+++ b/src/cmd/acme/dat.h Mon Dec 30 04:40:45 2024
+--- a/src/cmd/acme/dat.h Thu Jan 2 21:32:59 2025
++++ b/src/cmd/acme/dat.h Thu Jan 2 21:33:09 2025
@@ -222,7 +222,7 @@
void textscroll(Text*, int);
void textselect(Text*);
@@ -222,8 +222,8 @@ diff -u a/src/cmd/acme/dat.h b/src/cmd/acme/dat.h
int erroutfd;
Common subdirectories: a/src/cmd/acme/mail and b/src/cmd/acme/mail
diff -u a/src/cmd/acme/rows.c b/src/cmd/acme/rows.c
---- a/src/cmd/acme/rows.c Mon Dec 30 04:46:37 2024
-+++ b/src/cmd/acme/rows.c Mon Dec 30 04:40:45 2024
+--- a/src/cmd/acme/rows.c Thu Jan 2 21:32:59 2025
++++ b/src/cmd/acme/rows.c Thu Jan 2 21:33:10 2025
@@ -28,7 +28,7 @@
Rectangle r1;
Text *t;
@@ -329,8 +329,17 @@ diff -u a/src/cmd/acme/rows.c b/src/cmd/acme/rows.c
if(i >= row->ncol)
rowadd(row, nil, x);
diff -u a/src/cmd/acme/text.c b/src/cmd/acme/text.c
---- a/src/cmd/acme/text.c Mon Dec 30 04:46:37 2024
-+++ b/src/cmd/acme/text.c Mon Dec 30 04:48:09 2024
+--- a/src/cmd/acme/text.c Thu Jan 2 21:32:59 2025
++++ b/src/cmd/acme/text.c Thu Jan 2 21:33:10 2025
+@@ -667,7 +667,7 @@
+ void
+ texttype(Text *t, Rune r)
+ {
+- uint q0, q1;
++ uint q0, q1, qd;
+ int nnb, nb, n, i;
+ int nr;
+ Rune *rp;
@@ -694,8 +694,21 @@
case Kdown:
if(t->what == Tag)
@@ -376,23 +385,20 @@ diff -u a/src/cmd/acme/text.c b/src/cmd/acme/text.c
case Kscrolloneup:
if(t->what == Tag)
goto Tagup;
-@@ -835,10 +858,13 @@
- break; /* fall through to normal insertion case */
- case 0x1B:
- if(t->eq0 != ~0) {
-- if(t->eq0 <= t->q0)
-+ if(t->eq0 <= t->q0) {
- textsetselect(t, t->eq0, t->q0);
-- else
-+ moveto(mousectl, addpt(frptofchar(&t->fr, t->eq0), Pt(4, t->fr.font->height-4)));
-+ } else {
+@@ -840,6 +863,12 @@
+ else
textsetselect(t, t->q0, t->eq0);
-+ moveto(mousectl, addpt(frptofchar(&t->fr, t->q0), Pt(4, t->fr.font->height-4)));
-+ }
}
++
++ qd = 0;
++ if (t->eq0 <= t->iq1)
++ qd = (int) (t->iq1 - t->eq0) / 2;
++ moveto(mousectl, addpt(frptofchar(&t->fr, t->fr.p0 + qd), Pt(4, t->fr.font->height-4)));
++
if(t->ncache > 0)
typecommit(t);
-@@ -1258,7 +1284,7 @@
+ t->iq1 = t->q0;
+@@ -1258,7 +1287,7 @@
};
uint
@@ -401,7 +407,7 @@ diff -u a/src/cmd/acme/text.c b/src/cmd/acme/text.c
{
uint p0, p1, q, tmp;
ulong msec;
-@@ -1291,12 +1317,12 @@
+@@ -1291,12 +1320,12 @@
pt1 = pt0;
reg = region(q, p0);
if(reg == 0)
@@ -416,7 +422,7 @@ diff -u a/src/cmd/acme/text.c b/src/cmd/acme/text.c
else if(q < p1)
selrestore(f, qt, q, p1);
-@@ -1304,7 +1330,7 @@
+@@ -1304,7 +1333,7 @@
if(q > p1)
selrestore(f, pt1, p1, q);
else
@@ -425,7 +431,7 @@ diff -u a/src/cmd/acme/text.c b/src/cmd/acme/text.c
}
p1 = q;
pt1 = qt;
-@@ -1341,12 +1367,12 @@
+@@ -1341,12 +1370,12 @@
}
int
@@ -440,7 +446,7 @@ diff -u a/src/cmd/acme/text.c b/src/cmd/acme/text.c
buts = mousectl->m.buttons;
if((buts & mask) == 0){
*q0 = p0+t->org;
-@@ -1364,7 +1390,7 @@
+@@ -1364,7 +1393,7 @@
int buts;
*tp = nil;
@@ -449,7 +455,7 @@ diff -u a/src/cmd/acme/text.c b/src/cmd/acme/text.c
if(buts & 4)
return 0;
if(buts & 1){ /* pick up argument */
-@@ -1379,7 +1405,7 @@
+@@ -1379,7 +1408,7 @@
{
int h;
@@ -460,8 +466,8 @@ diff -u a/src/cmd/acme/text.c b/src/cmd/acme/text.c
Only in b/src/cmd/acme: tfile
diff -u a/src/cmd/acme/wind.c b/src/cmd/acme/wind.c
---- a/src/cmd/acme/wind.c Mon Dec 30 04:46:37 2024
-+++ b/src/cmd/acme/wind.c Mon Dec 30 04:40:46 2024
+--- a/src/cmd/acme/wind.c Thu Jan 2 21:32:59 2025
++++ b/src/cmd/acme/wind.c Thu Jan 2 21:33:10 2025
@@ -235,7 +235,6 @@
r1.min.y = min(y, r.max.y);
r1.max.y = r.max.y;