vc enhancements

Andrew F. Seirup afs at bunkerb.UUCP
Sat Jan 19 06:58:31 AEST 1985


   Once I finally got the copy row command (^J) to work, I wondered why there
wasn't a copy column command.  So I added one (^K).  Why ^K?  It's close to
^J (why is it ^J?).  Change it if it makes a difference to you.

   Also, not having used EMACS heavily for several years, and having used vi,
rogue, and hack in the meanwhile, I had difficulty adjusting to the cursor
control commands.  Since h, j, k, and l where unused commands, (you guessed it)
I added them as alternates to ^B, ^N, ^P, and ^F, with the exception that they
won't work to move the entry cursor while entering a long command.  The code
is copied from the originals (as is ^K copied from ^J with the obvious changes).


Andrew Seirup - Bunker Ramo, Trumbull CT - (203)386-2086 
uucp address:  {decvax|ittvax}!bunker!afs


*** 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);
+ 		    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;
***************
*** 424,429
  			    break;
  			case 'Q':
  			    running = 0;
  			    break;
  			default:
  			    if ((c & 0177) != c)

--- 456,493 -----
  			    break;
  			case 'Q':
  			    running = 0;
+ 			    break;
+ 			case 'h':
+ 			    while (--arg>=0) {
+ 				if (curcol)
+ 				    curcol--;
+ 				else
+ 				    error ("At column zero");
+ 			    }
+ 			    break;
+ 			case 'j':
+ 			    while (--arg>=0) {
+ 				if (currow < MAXROWS - 1)
+ 				    currow++;
+ 				else
+ 				    error ("The table can't be any longer");
+ 			    }
+ 			    break;
+ 			case 'k':
+ 			    while (--arg>=0) {
+ 				if (currow)
+ 				    currow--;
+ 				else
+ 				    error ("At row zero");
+ 			    }
+ 			    break;
+ 			case 'l':
+ 			    while (--arg>=0) {
+ 				if (curcol < MAXCOLS - 1)
+ 				    curcol++;
+ 				else
+ 				    error ("The table can't be any wider");
+ 			    }
  			    break;
  			default:
  			    if ((c & 0177) != c)



More information about the Comp.sources.unix mailing list