afs@bunkerb.UUCP (Andrew F. Seirup) (01/15/85)
{} The following context diff fixes some margin problems in vc (sc.c). Diff hunks 1, 2, 4, and 5 are a matter of taste (I like to know why a program is ignoring input), and hunks 3, 6, and 7 fix some rather bizzare behavior at the far margins (things were popping up back on the zero margin and overwriting what was supposed to be there). Don't forget to either redefine MAXROW to 100 or do something about the char declaration of row (refer to posting by Carl Lowenstein). Andrew Seirup - Bunker Ramo, Trumbull CT - (203)386-2086 uucp address: {decvax|ittvax}!bunker!afs *** sc.c Fri Jan 11 15:27:50 1985 --- sc.new Fri Jan 11 16:24:37 1985 *************** *** 209,216 error ("No such command (^%c)", c + 0100); break; case ctl (b): ! while (--arg>=0) if (curcol) ! curcol--; break; case ctl (c): running = 0; --- 209,220 ----- error ("No such command (^%c)", c + 0100); break; case ctl (b): ! while (--arg>=0) { ! if (curcol) ! curcol--; ! else ! error ("At column zero"); ! } break; case ctl (c): running = 0; *************** *** 216,223 running = 0; break; case ctl (f): ! while (--arg>=0) if (curcol < MAXCOLS - 1) ! curcol++; break; case ctl (g): linelim = -1; --- 220,231 ----- running = 0; break; case ctl (f): ! while (--arg>=0) { ! if (curcol < MAXCOLS - 1) ! curcol++; ! else ! error ("The table can't be any wider"); ! } break; case ctl (g): linelim = -1; *************** *** 230,236 line[--linelim] = 0; break; case ctl (j): ! if (currow >= MAXCOLS - 1 || maxcol >= MAXCOLS - 1) { error ("The table can't be any bigger"); break; } --- 238,244 ----- line[--linelim] = 0; break; case ctl (j): ! if (currow >= MAXROWS - 1 || maxrow >= MAXROWS - 1) { error ("The table can't be any bigger"); break; } *************** *** 274,281 } break; case ctl (n): ! while (--arg>=0) if (currow < MAXROWS - 1) ! currow++; break; case ctl (p): while (--arg>=0) if (currow) --- 282,293 ----- } break; case ctl (n): ! while (--arg>=0) { ! if (currow < MAXROWS - 1) ! currow++; ! else ! error ("The table can't be any longer"); ! } break; case ctl (p): while (--arg>=0) { *************** *** 278,285 currow++; break; case ctl (p): ! while (--arg>=0) if (currow) ! currow--; break; case ctl (q): break; /* ignore flow control */ --- 290,301 ----- } break; case ctl (p): ! while (--arg>=0) { ! if (currow) ! currow--; ! else ! error ("At row zero"); ! } break; case ctl (q): break; /* ignore flow control */ *************** *** 546,553 register r; register struct ent **p; register c; ! if (maxcol >= MAXCOLS - 1) { ! error ("The table can't be any bigger"); return; } for (r = ++maxrow; r > rs; r--) --- 562,571 ----- register r; register struct ent **p; register c; ! ! if (rs > maxrow) maxrow = rs; ! if (maxrow >= MAXROWS - 1 || rs > MAXROWS - 1) { ! error ("The table can't be any longer"); return; } for (r = ++maxrow; r > rs; r--) *************** *** 587,593 register lim = maxcol-cs+1; int i; ! for (i = MAXCOLS - 1; i > cs; i--) { fwidth[i] = fwidth[i-1]; precision[i] = precision[i-1]; } --- 605,616 ----- register lim = maxcol-cs+1; int i; ! if (cs > maxcol) maxcol = cs; ! if (maxcol >= MAXCOLS - 1 || cs > MAXCOLS - 1) { ! error ("The table can't be any wider"); ! return; ! } ! for (i = maxcol - 1; i > cs; i--) { fwidth[i] = fwidth[i-1]; precision[i] = precision[i-1]; }