PROCEDURE NEXTCOMMAND;
BEGIN
  IF NEEDPROMPT THEN
    BEGIN
      PROMPTLINE:=
' Edit: A(djst C(py D(lete F(ind I(nsrt J(mp R(place Q(uit X(chng Z(ap  [E.4]';
      PROMPT;
      NEEDPROMPT:=FALSE;
      SHOWCURSOR
    END;
  CH:=GETCH;
  COMMAND:=MAPTOCOMMAND(CH);
END(* NEXTCOMMAND *);

PROCEDURE COMMANDER;
BEGIN
  INFINITY:=FALSE;
  IF COMMAND=SLASHC THEN 
    BEGIN REPEATFACTOR:=1; INFINITY:=TRUE; NEXTCOMMAND END
  ELSE
    IF COMMAND=DIGIT THEN REPEATFACTOR:=GETNUM ELSE REPEATFACTOR:=1;
  CASE COMMAND OF 
    ILLEGAL: BEGIN ERRWAIT; SHOWCURSOR; NEXTCOMMAND END;
    REVERSEC,FORWARDC: FIXDIRECTION;
    COPYC: COPY;
    DUMPC: DUMP;
    FINDC: FIND;
    INSERTC: INSERTIT;
    JUMPC: JUMP;
    LISTC: NEXTCOMMAND; (* NOT YET, DEPENDS ON TERAK PAN *)
    MACRODEFC: DEFMACRO;
    QUITC: ; (* EXIT HANDLED IN OUTER BLOCK *)
    REPLACEC: FIND;
    SETC: SETSTUFF;
    VERIFYC: VERIFY;
    XECUTEC: XMACRO;
    ZAPC: ZAPIT;
    EQUALC: BEGIN
      CURSOR:=LASTPAT;
      GETLEADING;
      CURSOR:=MAX(CURSOR,STUFFSTART);
      CENTERCURSOR(TRASH,MIDDLE,FALSE); 
      SHOWCURSOR; NEXTCOMMAND 
    END;
    ADJUSTC,DELETEC,PARAC,UP,DOWN,LEFT,RIGHT,ADVANCE,TAB,SPACE: MOVEIT
  END (* BIG LONG CASE STATEMENT *);
END (* COMMANDER *);

BEGIN (* Editcore *)
  NEXTCOMMAND;
  WHILE COMMAND<>QUITC DO COMMANDER
END;


