commit - ba51ae9877aef8da2a6ee49e354d9b8148b0e93a
commit + f460c311450164c30dd3d030655f6125219d2708
blob - bc8d3e3e18ac853017273ec42409ed5757c1020e
blob + 6b14477929069f099af363f1d3196e4872166a24
--- src/cmd/acme/text.c
+++ src/cmd/acme/text.c
return;
case Kdown:
if(t->what == Tag)
- goto Tagdown;
- n = t->fr.maxlines/3;
- goto case_Down;
+ goto Tagdown;
+ typecommit(t);
+ /* 1rst check for being in the last line*/
+ q0 = t->q0;
+ q1 = q0;
+ if (q1) q1--;
+ nnb = 0;
+ while(q0<t->file->b.nc && textreadc(t, q0)!='\n')
+ q0++;
+ if (q0 == (t->file->b.nc)-1) {
+ textshow(t, q0, q0, TRUE);
+ return;
+ }
+ q0++;
+ /* find old pos in ln */
+ while(q1>1 && textreadc(t, q1)!='\n'){
+ nnb++;
+ q1--;
+ }
+ /* go right until reachg pos or \n */
+ while(q0<t->file->b.nc && (nnb>0 && textreadc(t, q0)!='\n')){
+ q0++;
+ nnb--;
+ }
+ if (q0>1 && q0<t->file->b.nc)
+ textshow(t, q0, q0, TRUE);
+ return;
case Kscrollonedown:
if(t->what == Tag)
goto Tagdown;
case Kup:
if(t->what == Tag)
goto Tagup;
- n = t->fr.maxlines/3;
- goto case_Up;
+ typecommit(t);
+ nnb = 0;
+ if(t->q0>0 && textreadc(t, t->q0-1)!='\n')
+ nnb = textbswidth(t, 0x15);
+ /* BOL - 1 if not first line of txt BOL*/
+ if( t->q0-nnb > 1 && textreadc(t, t->q0-nnb-1)=='\n' ) nnb++;
+ textshow(t, t->q0-nnb, t->q0-nnb, TRUE);
+ return;
case Kscrolloneup:
if(t->what == Tag)
goto Tagup;