hans@log-hb.UUCP (Hans Albertsson) (01/06/85)
The posted version of the vc spreadsheet calculator had a couple of irritating features, and one real bug. Features, irritating: The help message was erroneously placed on the screen, and long enough to evoke the wrap bug of DEC terminals. The screen got messed up badly. Fix to lex.c below. The normal choice for erase character backwards may well be ^H, but to me that's utterly unnatural. I simply added DEL to do the same. Really, one should ask an ioctl to get the character in question. Since ^U arg does the emacs thing, why not have <ESC> arg act similarly. These are fixed in sc.c below. Bug, real: If the entry cursor moved over a position occupied by a character, that character was erased from the screen. Fixed by saving what was there before, and replacing. Fixed in sc.c. Commands for the below diffs were rcsdiff -c -r1.1 file.ext > tmpfile in both cases. *** /tmp/,RCSt1007414 Sun Jan 6 13:20:29 1985 --- sc.c Sun Jan 6 00:13:56 1985 *************** *** 63,68 register struct ent **p; static lastmx, lastmy; int maxcol; int rows = LINES - 2; int cols; --- 63,69 ----- register struct ent **p; static lastmx, lastmy; + static char *under_cursor = " "; int maxcol; int rows = LINES - 2; int cols; *************** *** 113,119 c += fwidth[col]; } } ! mvaddstr (lastmy, lastmx, " "); lastmy = currow - strow + 2; lastmx = 0; for (col = stcol; col <= curcol;) --- 114,121 ----- c += fwidth[col]; } } ! ! mvaddstr (lastmy, lastmx, under_cursor); lastmy = currow - strow + 2; lastmx = 0; for (col = stcol; col <= curcol;) *************** *** 118,124 lastmx = 0; for (col = stcol; col <= curcol;) lastmx += fwidth[col++]; ! mvaddstr (lastmy, lastmx, "<"); move (0, 0); clrtoeol (); if (linelim >= 0) { --- 120,128 ----- lastmx = 0; for (col = stcol; col <= curcol;) lastmx += fwidth[col++]; ! move( lastmy, lastmx); ! *under_cursor = inch(); ! addstr ("<"); move (0, 0); clrtoeol (); if (linelim >= 0) { *************** *** 185,191 clrtoeol (); fflush (stdout); seenerr = 0; ! if ((c = nmgetch ()) < ' ') switch (c) { case ctl (z): noraw (); --- 189,195 ----- clrtoeol (); fflush (stdout); seenerr = 0; ! if (((c = nmgetch ()) < ' ') || ( c == 0177 )) switch (c) { case ctl (z): noraw (); *************** *** 220,225 move (1, 0); clrtoeol (); break; case ctl (h): while (--arg>=0) if (linelim > 0) line[--linelim] = 0; --- 224,230 ----- move (1, 0); clrtoeol (); break; + case 0177: case ctl (h): while (--arg>=0) if (linelim > 0) line[--linelim] = 0; *************** *** 280,285 break; /* ignore flow control */ case ctl (s): break; /* ignore flow control */ case ctl (u): narg = arg * 4; nedistate = 1; --- 285,294 ----- break; /* ignore flow control */ case ctl (s): break; /* ignore flow control */ + case 033: + narg = arg; + nedistate = 1; + break; case ctl (u): narg = arg * 4; nedistate = 1; *** /tmp/,RCSt1007424 Sun Jan 6 13:21:29 1985 --- lex.c Sat Jan 5 20:12:50 1985 *************** *** 94,100 int dbline; debug (fmt, a, b, c) { ! move (3+(dbline++%22),40); clrtoeol(); printw (fmt,a,b,c); } --- 94,100 ----- int dbline; debug (fmt, a, b, c) { ! mvprintw (2+(dbline++%22),40,fmt,a,b,c); clrtoeol(); } *************** *** 96,102 debug (fmt, a, b, c) { move (3+(dbline++%22),40); clrtoeol(); - printw (fmt,a,b,c); } help () { --- 96,101 ----- debug (fmt, a, b, c) { mvprintw (2+(dbline++%22),40,fmt,a,b,c); clrtoeol(); } help () { *************** *** 102,114 help () { dbline = 0; /* "====================!===================" */ ! debug ("|^N next row ^P previous row"); ! debug ("|^F next column ^B previous column"); ! debug ("|^C exit ^G erase command"); ! debug ("|^H erase char ^L fix screen"); ! debug ("|^J open new row ^V type var name"); ! debug ("|^A type var value ^E type var expr"); ! debug ("|^R redraw screen ? help (this msg)"); debug ("|"); debug ("|= enter new value C clear entry"); debug ("|\" label f set format"); --- 101,113 ----- help () { dbline = 0; /* "====================!===================" */ ! debug ("|^N next row ^P previous row"); ! debug ("|^F next column ^B previous column"); ! debug ("|^C exit ^G erase command"); ! debug ("|DEL,^H erase char ^L fix screen"); ! debug ("|^J open new row ^V type var name"); ! debug ("|^A type var value ^E type var expr"); ! debug ("|^R redraw screen ? help (this msg)"); debug ("|"); debug ("|= enter new value C clear entry"); debug ("|\" label f set format"); *************** *** 110,123 debug ("|^A type var value ^E type var expr"); debug ("|^R redraw screen ? help (this msg)"); debug ("|"); ! debug ("|= enter new value C clear entry"); ! debug ("|\" label f set format"); ! debug ("|< left flush str > right flush str"); ! debug ("|g get database p put database"); ! debug ("|w write listing T write tbl fmt"); ! debug ("|r open row here c open col here"); ! debug ("|d delete this row D delete this col"); ! debug ("|E edit string e edit value"); debug ("|M merge in database"); debug ("|"); debug ("| ***operators***"); --- 109,122 ----- debug ("|^A type var value ^E type var expr"); debug ("|^R redraw screen ? help (this msg)"); debug ("|"); ! debug ("|= enter new value C clear entry"); ! debug ("|\" label f set format"); ! debug ("|< left flush str > right flush str"); ! debug ("|g get database p put database"); ! debug ("|w write listing T write tbl fmt"); ! debug ("|r open row here c open col here"); ! debug ("|d delete this row D delete this col"); ! debug ("|E edit string e edit value"); debug ("|M merge in database"); debug ("|"); debug ("| ***operators***"); -- Hans Albertsson, USENET/uucp: {decvax,philabs}!mcvax!enea!log-hb!hans Real World: TeleLOGIC AB, Box 1001, S-14901 Nynashamn,SWEDEN