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