Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.6.2.17 $; site waltz.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!inuxc!pur-ee!uiucdcs!waltz!haddock From: haddock@waltz.UUCP Newsgroups: net.sources Subject: Re: vc enhancements Message-ID: <37300002@waltz.UUCP> Date: Mon, 28-Jan-85 04:55:00 EST Article-I.D.: waltz.37300002 Posted: Mon Jan 28 04:55:00 1985 Date-Received: Wed, 30-Jan-85 05:49:21 EST References: <423@bunkerb.UUCP> Lines: 101 Nf-ID: #R:bunkerb:-42300:waltz:37300002:000:2962 Nf-From: waltz!haddock Jan 28 03:55:00 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@CSNet-Relay Rusty@Maryland (forwarded to CSNet address) CSNet: Haddock@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; ***************