acme: fix Kup

This commit is contained in:
gutmet 2020-08-27 16:11:43 +02:00
parent ff7c8efd36
commit f8d88a8a66

View File

@ -48,15 +48,13 @@ index e5658a4e..2c79b387 100644
r = Rect(0, 0, Scrollwid+ButtonBorder, font->height+1);
diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c
index 09422dda..81e5eb36 100644
index 09422dda..292dcd47 100644
--- a/src/cmd/acme/text.c
+++ b/src/cmd/acme/text.c
@@ -692,10 +692,16 @@ texttype(Text *t, Rune r)
textshow(t, t->q1+1, t->q1+1, TRUE);
return;
@@ -694,8 +694,16 @@ texttype(Text *t, Rune r)
case Kdown:
- if(t->what == Tag)
- goto Tagdown;
if(t->what == Tag)
goto Tagdown;
- n = t->fr.maxlines/3;
- goto case_Down;
+ typecommit(t);
@ -72,20 +70,23 @@ index 09422dda..81e5eb36 100644
case Kscrollonedown:
if(t->what == Tag)
goto Tagdown;
@@ -712,8 +718,10 @@ texttype(Text *t, Rune r)
@@ -712,8 +720,13 @@ texttype(Text *t, Rune r)
case Kup:
if(t->what == Tag)
goto Tagup;
- n = t->fr.maxlines/3;
- goto case_Up;
+ q0 = textbacknl(t, t->q0, 1);
+ if(q0 > 1)
+ textshow(t, q0-1, q0-1, TRUE);
+ typecommit(t);
+ nnb = 0;
+ if(t->q0 > 0 && textreadc(t, t->q0-1) != '\n')
+ nnb = textbswidth(t, 0x15);
+ if(t->q0-nnb > 1)
+ textshow(t, t->q0-nnb-1, t->q0-nnb-1, TRUE);
+ return;
case Kscrolloneup:
if(t->what == Tag)
goto Tagup;
@@ -725,7 +733,7 @@ texttype(Text *t, Rune r)
@@ -725,7 +738,7 @@ texttype(Text *t, Rune r)
q0 = textbacknl(t, t->org, n);
textsetorigin(t, q0, TRUE);
return;
@ -94,7 +95,7 @@ index 09422dda..81e5eb36 100644
typecommit(t);
if(t->org > t->iq1) {
q0 = textbacknl(t, t->iq1, 1);
@@ -733,7 +741,7 @@ texttype(Text *t, Rune r)
@@ -733,7 +746,7 @@ texttype(Text *t, Rune r)
} else
textshow(t, 0, 0, FALSE);
return;
@ -103,7 +104,7 @@ index 09422dda..81e5eb36 100644
typecommit(t);
if(t->iq1 > t->org+t->fr.nchars) {
if(t->iq1 > t->file->b.nc) {
@@ -745,7 +753,7 @@ texttype(Text *t, Rune r)
@@ -745,7 +758,7 @@ texttype(Text *t, Rune r)
} else
textshow(t, t->file->b.nc, t->file->b.nc, FALSE);
return;
@ -112,7 +113,7 @@ index 09422dda..81e5eb36 100644
typecommit(t);
/* go to where ^U would erase, if not already at BOL */
nnb = 0;
@@ -753,22 +761,25 @@ texttype(Text *t, Rune r)
@@ -753,22 +766,25 @@ texttype(Text *t, Rune r)
nnb = textbswidth(t, 0x15);
textshow(t, t->q0-nnb, t->q0-nnb, TRUE);
return;
@ -143,7 +144,7 @@ index 09422dda..81e5eb36 100644
typecommit(t);
undo(t, nil, nil, FALSE, 0, nil, 0);
return;
@@ -796,7 +807,8 @@ texttype(Text *t, Rune r)
@@ -796,7 +812,8 @@ texttype(Text *t, Rune r)
}
/* cut/paste must be done after the seq++/filemark */
switch(r){
@ -153,7 +154,7 @@ index 09422dda..81e5eb36 100644
typecommit(t);
if(t->what == Body){
seq++;
@@ -806,7 +818,8 @@ texttype(Text *t, Rune r)
@@ -806,7 +823,8 @@ texttype(Text *t, Rune r)
textshow(t, t->q0, t->q0, 1);
t->iq1 = t->q0;
return;
@ -163,7 +164,7 @@ index 09422dda..81e5eb36 100644
typecommit(t);
if(t->what == Body){
seq++;
@@ -825,7 +838,7 @@ texttype(Text *t, Rune r)
@@ -825,7 +843,7 @@ texttype(Text *t, Rune r)
}
textshow(t, t->q0, t->q0, 1);
switch(r){
@ -172,7 +173,7 @@ index 09422dda..81e5eb36 100644
case Kins:
typecommit(t);
rp = textcomplete(t);
@@ -844,9 +857,15 @@ texttype(Text *t, Rune r)
@@ -844,9 +862,15 @@ texttype(Text *t, Rune r)
typecommit(t);
t->iq1 = t->q0;
return;