Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!news.cs.indiana.edu!maytag!mks.com!ant From: ant@mks.com (Anthony Howe) Newsgroups: comp.editors Subject: Simple Editor -- bug fixes Keywords: simple, editor, ae Message-ID: <1991Jun6.214538.15149@mks.com> Date: 6 Jun 91 21:45:38 GMT Article-I.D.: mks.1991Jun6.214538.15149 Sender: ant@mks.com (Anthony Howe) Organization: Mortice Kern Systems, Waterloo, Ontario, CANADA Lines: 92 << ae >> Bug Fixes =================== Hmmm, looks like I made a booboo or two. 1) watmath!presto.bos.Camex.COM!ayk (Andrew Kobayashi) -- > It doesn't quite handle going from left-to-right over > the gap correctly. The fixes, alas, make the program > six bytes longer. Without the fixes, whenever i did > an "l" over the gap the cursor would move straight > down. A second "l" moved the cursor back up and over > two characters, that is, to the correct position. I figured out how to generate this. The following keys strokes demonstrate the bug. ae foo i ---- insert some text some text on line 1^M ---- line 1 even more text on the next line^L ---- line 2 tll ---- sit on the 'm' in line 1 i^L ---- move the gap to just before 'm' t ---- move point to top of file ll ---- cursor ends up on 'v' l ---- cursor ends up on 'e' in "some" > Here's the fix: > > R(){p=p-g?p:h;p > becomes > > R(){p=p-(g-1)?p:h-1;p>" string until the first insert command. Again thanks for everyone's kind remarks and inquiries. Below is an updated version of the source. - ant ------->8-------- #include #define Z(x) (x==' '||x=='\t'||x=='\n') int a,d,i,q=1,x,y;char b[BUF],*c,*g=b,*h,*p,*m=b,*n,*f, k[]="hjklHJKL[]tbixWRQ";S(){p=b>");move(y,x);refresh();} main(u,v)char**v;{h=n=c=b+BUF;if(u<2)return 2;initscr();d=LINES;raw(); noecho();idlok(stdscr,1); if(0<(i=open(f= *++v,0)))g+=read(i,b,BUF),g=g