acme: move cursor on page down/up

This commit is contained in:
gutmet 2020-08-27 20:49:11 +02:00
parent c1b85c58f7
commit d77832937c
2 changed files with 20 additions and 10 deletions

View File

@ -48,7 +48,7 @@ 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..14372418 100644
index 09422dda..fc67ebad 100644
--- a/src/cmd/acme/text.c
+++ b/src/cmd/acme/text.c
@@ -694,8 +694,16 @@ texttype(Text *t, Rune r)
@ -70,7 +70,13 @@ index 09422dda..14372418 100644
case Kscrollonedown:
if(t->what == Tag)
goto Tagdown;
@@ -712,8 +720,13 @@ texttype(Text *t, Rune r)
@@ -708,12 +716,19 @@ texttype(Text *t, Rune r)
case_Down:
q0 = t->org+frcharofpt(&t->fr, Pt(t->fr.r.min.x, t->fr.r.min.y+n*t->fr.font->height));
textsetorigin(t, q0, TRUE);
+ if(n>10)
+ textshow(t, q0, q0, TRUE);
return;
case Kup:
if(t->what == Tag)
goto Tagup;
@ -86,16 +92,19 @@ index 09422dda..14372418 100644
case Kscrolloneup:
if(t->what == Tag)
goto Tagup;
@@ -725,7 +738,7 @@ texttype(Text *t, Rune r)
@@ -724,8 +739,10 @@ texttype(Text *t, Rune r)
case_Up:
q0 = textbacknl(t, t->org, n);
textsetorigin(t, q0, TRUE);
+ if(n>10)
+ textshow(t, q0, q0, TRUE);
return;
- case Khome:
+ case 0x01: /* ^A: beginning of file */
typecommit(t);
if(t->org > t->iq1) {
q0 = textbacknl(t, t->iq1, 1);
@@ -733,7 +746,7 @@ texttype(Text *t, Rune r)
@@ -733,7 +750,7 @@ texttype(Text *t, Rune r)
} else
textshow(t, 0, 0, FALSE);
return;
@ -104,7 +113,7 @@ index 09422dda..14372418 100644
typecommit(t);
if(t->iq1 > t->org+t->fr.nchars) {
if(t->iq1 > t->file->b.nc) {
@@ -745,7 +758,7 @@ texttype(Text *t, Rune r)
@@ -745,7 +762,7 @@ texttype(Text *t, Rune r)
} else
textshow(t, t->file->b.nc, t->file->b.nc, FALSE);
return;
@ -113,7 +122,7 @@ index 09422dda..14372418 100644
typecommit(t);
/* go to where ^U would erase, if not already at BOL */
nnb = 0;
@@ -753,22 +766,25 @@ texttype(Text *t, Rune r)
@@ -753,22 +770,25 @@ texttype(Text *t, Rune r)
nnb = textbswidth(t, 0x15);
textshow(t, t->q0-nnb, t->q0-nnb, TRUE);
return;
@ -144,7 +153,7 @@ index 09422dda..14372418 100644
typecommit(t);
undo(t, nil, nil, FALSE, 0, nil, 0);
return;
@@ -796,7 +812,8 @@ texttype(Text *t, Rune r)
@@ -796,7 +816,8 @@ texttype(Text *t, Rune r)
}
/* cut/paste must be done after the seq++/filemark */
switch(r){
@ -154,7 +163,7 @@ index 09422dda..14372418 100644
typecommit(t);
if(t->what == Body){
seq++;
@@ -806,7 +823,8 @@ texttype(Text *t, Rune r)
@@ -806,7 +827,8 @@ texttype(Text *t, Rune r)
textshow(t, t->q0, t->q0, 1);
t->iq1 = t->q0;
return;
@ -164,7 +173,7 @@ index 09422dda..14372418 100644
typecommit(t);
if(t->what == Body){
seq++;
@@ -825,7 +843,7 @@ texttype(Text *t, Rune r)
@@ -825,7 +847,7 @@ texttype(Text *t, Rune r)
}
textshow(t, t->q0, t->q0, 1);
switch(r){
@ -173,7 +182,7 @@ index 09422dda..14372418 100644
case Kins:
typecommit(t);
rp = textcomplete(t);
@@ -844,9 +862,15 @@ texttype(Text *t, Rune r)
@@ -844,9 +866,15 @@ texttype(Text *t, Rune r)
typecommit(t);
t->iq1 = t->q0;
return;

View File

@ -4,6 +4,7 @@ Changes to acme
- changed color scheme to dark background and light text
- changed keyboard shortcuts:
- Down and Up now move the cursor to the end of the line below/above
- If you scroll more than 10 lines at a time, the cursor moves along
- switched behavior of Home/End with ^A/^E
- Ctrl+c, Ctrl+x, Ctrl+v now work as expected
- Ctrl+z for undo, Ctrl+y for redo