vc enhancements
haddock at waltz.UUCP
haddock at waltz.UUCP
Mon Jan 28 19:55:00 AEST 1985
Andrew,
Many thanks for your use of the `vi' h,j,k, and l cursor motion
keys. Definitely a blessing for us mortals that tend to shy
away from Emacs. Alas, I don't believe that your ^K patch is
quite complete.
When you execute the ^K command the width and precision of the
duplicated column do not get carried over to the new (duplicate)
column. The simple fix is to add the following two lines just
after the opencol() in the ctl(k) case you added [sc.c].
fwidth[curcol] = fwidth[curcol-1];
precision[curcol] = precision[curcol-1];
An even simpler modification would have been to change the
conditional in the proper for() loop in opencol() [sc.c].
for (i = maxcol - 1; i > cs; i--) {
^-------------- change to >=
fwidth[i] = fwidth[i-1];
precision[i] = precision[i-1];
}
/* fwidth[cs] = DEFWIDTH;
precision[i] = DEFPREC; */
If done this way the "open column" command, 'c', would
open a column with the width and precision of the column to its
immediate left as opposed to the one the cursor was on when the
command was given.
Comments welcome. Flames - dowse 'em and be nice instead.
================================================================
_____
-Rusty- |\/ o \ o
| ( -< O o Where's the fish?
|/\__V__/
ARPA: Haddock%Waltz%TI-CSL at CSNet-Relay
Rusty at Maryland (forwarded to CSNet address)
CSNet: Haddock at TI-CSL
USENET: {convex!smu, ut-sally, texsun, rice} ! waltz ! haddock
================================================================
Your diff would now look like this:
*** sc.c Fri Jan 18 09:06:13 1985
--- sc.new Thu Jan 17 16:01:04 1985
***************
*** 269,274
if (curcol > maxcol)
curcol = 0;
break;
case ctl (l):
FullUpdate++;
break;
--- 269,306 -----
if (curcol > maxcol)
curcol = 0;
break;
+ case ctl (k):
+ if (curcol >= MAXCOLS - 1 || maxcol >= MAXCOLS - 1) {
+ error ("The table can't be any wider");
+ break;
+ }
+ modflg++;
+ curcol++;
+ opencol (curcol);
++ fwidth[curcol] = fwidth[curcol-1];
++ precision[curcol] = precision[curcol-1];
+ for (currow = 0; currow <= maxrow; currow++) {
+ register struct ent *p = tbl[currow][curcol - 1];
+ if (p) {
+ register struct ent *n;
+ n = lookat (currow, curcol);
+ n -> v = p -> v;
+ n -> flags = p -> flags;
+ n -> expr = copye (p -> expr, 0, 1);
+ n -> label = 0;
+ if (p -> label) {
+ n -> label = (char *)
+ malloc (strlen (p -> label) + 1);
+ strcpy (n -> label, p -> label);
+ }
+ }
+ }
+ for (currow = 0; currow <= maxrow; currow++) {
+ register struct ent *p = tbl[currow][curcol];
+ if (p && (p -> flags & is_valid) && !p -> expr)
+ break;
+ }
+ if (currow > maxrow)
+ currow = 0;
+ break;
case ctl (l):
FullUpdate++;
break;
***************
More information about the Comp.sources.unix
mailing list