\ZEDITOR Oct1986:gt THESE SCREENS MAY BE COPIED/IMPROVED, BUT NOT SOLD This is a full screen, full feature editor by Louis Witt, a.k.a. Wittsoft, Inc Orlando, FL And was distributed by John A. Peters 121 Santa Rosa Ave. San Francisco, CA 94122 as a part of the Silicon Valley FIG's disk library I have modified it slighlty, while "back-slashing" out most of (I think) John's mods. Gene Thomas 7705 Apache Rd. Little Rock, AR 72205 \ ZEDITOR Oct1986:gt\ Main change is non-display of the line editors editing \ line (line 18) while in zedit. ONLY FORTH ALSO EDITOR ALSO DEFINITIONS 1 11 +THRU ONLY FORTH ALSO DEFINITIONS CR .( Zeditor is loaded ) \ ZEDIT Oct1986:gtADM-3A \ I'm using a modified .ALL in utility.blk SEE SCREEN 13 \ : .ALL DISK-ERROR @ 0= IF DX 0 AT .SCR #OUT @ BLOT ?STAMP \ L/SCR 0 DO I CHANGED? IF I REDISPLAY THEN LOOP \ 'START 'VIDEO B/BUF CMOVE 0 17 AT 0 BLOT 0 18 AT \ .LINE 0 19 AT -LINE 0 23 AT #OUT OFF THEN ; \ ' .ALL IS .SCREEN VARIABLE INSERTING INSERTING OFF \ 16 CONSTANT TAB-SIZE ONLY FORTH ALSO EDITOR ALSO DEFINITIONS : Q; COMPILE EDIT-AT ['] ; EXECUTE ; IMMEDIATE : CURSOR-1 CURSOR IF -1 C THEN Q; : CURSOR+1 CURSOR C/SCR 1- < IF 1 C THEN Q; : CURSOR+ 0< IF CURSOR-1 ELSE CURSOR+1 THEN ; : EDGE+? CURSOR SWAP 0< IF 0= ELSE C/SCR 1- = THEN ; \ ZEDIT Oct1986:gtONLY FORTH ALSO EDITOR ALSO DEFINITIONS DUP CURSOR+ DUP EDGE+? UNTIL DROP Q; : >BLANK BEGIN 'CURSOR C@ BL = IF DROP EXIT THEN DUP CURSOR+ DUP EDGE+? UNTIL DROP Q; : WORD+ 'CURSOR C@ BL <> IF DUP >BLANK THEN DUP >NONBLANK 0>= IF EXIT THEN -1 >BLANK 'CURSOR C@ BL = IF 1 C THEN Q; : (MFL!) EDIT-AT 'C#A TYPE MODIFIED Q; : MFL! R> ['] (MFL!) >BODY >R >R ; \ONLY FORTH ALSO EDITOR ALSO DEFINITIONS \ clear-line 24 emit ; : .INSERTING 45 0 AT INSERTING @ IF ." Inserting" ELSE ." " THEN Q; : (MFY!) .ALL .INSERTING ; : MFY! R> ['] (MFY!) >BODY >R >R MODIFIED ; : WORD-LEFT -1 WORD+ Q; : WORD-RIGHT 1 WORD+ Q; : CHAR-LEFT CURSOR-1 ; : CHAR-RIGHT CURSOR+1 ; L/SCR 1- CONSTANT L15 : CHAR-UP C/L LINE# 0= IF DROP 0 THEN NEGATE C Q; : CHAR-DOWN C/L LINE# L15 = IF DROP 0 THEN C Q; : NEXT-LINE LINE# 1+ L15 MIN T Q; \ : TAB-RIGHT COL# TAB-SIZE MOD TAB-SIZE SWAP - C Q; ONLY FORTH ALSO EDITOR ALSO DEFINITIONS Oct1986:gt: TOP-LINE COL# R# ! Q; \ : BOTTOM-LINE COL# L/SCR 1- T C Q; : QUASH 'VIDEO B/BUF ERASE ; : REPAINT QUASH (MFY!) Q; : DROP-MODS EMPTY-BUFFERS QUASH (MFY!) Q; : BACK-SCREEN B QUASH (MFY!) Q; : ALT-SCREEN A QUASH (MFY!) Q; : NEXT-SCREEN N QUASH (MFY!) Q; : KEEP-MODS W Q; : INS-TGL INSERTING DUP @ NOT SWAP ! .INSERTING ; : ALT-FCH MFL! 0 +T A 'CURSOR PAD C/L MOVE A PAD 'CURSOR C/L MOVE ; : LIN-FCH MFL! 0 +T 'VIDEO R# @ + 'CURSOR C/L MOVE ; : >SL SL Q; ONLY FORTH ALSO EDITOR ALSO DEFINITIONS Oct1986:gt: DEL-LINE MFY! X Q; : DEL-EOL MFL! 'C#A BLANK Q; : DL-TXT CURSOR SWAP - DUP NEGATE C 'C#A ROT DELETE Q; : DL-JN DUP 'START + C@ BL <> IF DL-TXT ELSE R# ! JOIN THEN Q; : DEL-WORD MFY! CURSOR LINE# WORD-RIGHT LINE# OVER <> SWAP L/SCR 1- <> AND IF DL-JN ELSE DL-TXT THEN ; : DEL-CHAR MFY! BL 'CURSOR C! COL# C/L 1- <> IF CURSOR 1 C DL-TXT THEN Q; \ ZEDIT Oct1986:gt: PR-CH? DUP BL >= SWAP ASCII ~ <= AND ; : MAKE-ROOM COL# C/L 1- = IF EXIT THEN LINE# 1+ C/L * 1- 'START + C@ BL <> IF BEEP THEN 'CURSOR DUP 1+ #AFTER 1- MOVE ; : PUT-CHAR DUP PR-CH? NOT IF DROP BEEP EXIT THEN INSERTING @ IF MAKE-ROOM MFL! THEN DUP EMIT 'CURSOR C! CURSOR+1 MODIFIED Q; : Z-SPLIT L/SCR 1- C/L * 'START + C/L -TRAILING SWAP DROP 0= IF SPLIT NEXT-LINE CURSOR COL# - DL-TXT CHAR-UP MFY! ELSE BEEP THEN Q; IF CURSOR 1 C DL-TXT THEN Q; : GO-CHAR 2* KEY-TBL + PERFORM ; : := KEY-TBL BL WORD 1+ C@ 31 AND 27 MIN 2* + ' SWAP ! ; \ ZEDIT Oct1986:gt \ : ZKEY KEY DUP 127 = IF DROP 1 CURSOR-1 THEN ; : ZEXIT R> R> 2DROP CR ['] .LINE IS (.LINE) 0 18 AT .LINE 0 20 AT ; \ VARIABLE QKEY-TBL 28 2* ALLOT \ : Q-GO-CHAR 2* QKEY-TBL + PERFORM ; \ : :Q> QKEY-TBL BL WORD 1+ C@ 31 AND 27 MIN 2* + ' SWAP ! ; VARIABLE SCR-PREVIOUS \ : SCR-SAVE SCR @ SCR-PREVIOUS SWAP ! ; \ : SCR-ZERO SCR-SAVE ZEXIT 0 EDIT ; \ : SCR-PRIOR SCR-PREVIOUS @ SCR ! Q; \ : E.O.F. SCR-SAVE CAPACITY 1- SCR ! Q; \ ZEDIT Oct1986:gt \ : Z-WIPE WIPE (MFY!) ; : INSERT-CHAR INSERTING @ >R INSERTING ON BL PUT-CHAR R> INSERTING ! CHAR-LEFT ; \ : LEFT-END LINE# T Q; \ : RIGHT-END LINE# 1+ T -1 C Q; : Z-JOIN JOIN (MFY!) ; : OPEN-LINE PAD C/L 2DUP BLANK 'LINE #REMAINING INSERT MODIFIED (MFY!) ; \ : MTB EMPTY-BUFFERS ED ; : Z-TOP TOP Q; \ : INS-BUF I (MFY!) ; IF CURSOR 1 C DL-\ ZEDIT Oct1986:gt\S : RE-LOAD-Q 0 18 AT SCR @ LOAD (MFY!) ; : (Q) ZKEY DUP BL < IF Q-GO-CHAR ELSE PUT-CHAR THEN ; :Q> A ALT-SCREEN :Q> K BEEP :Q> U Z-SPLIT :Q> B BACK-SCREEN :Q> L RE-LOAD-Q :Q> V BEEP :Q> C E.O.F. :Q> M MTB :Q> W KEEP-MODS :Q> D RIGHT-END :Q> N Z-WIPE :Q> Z BOTTOM-LINE :Q> E TOP-LINE :Q> O SWITCH :Q> Y Z-WIPE :Q> P BEEP :Q> X SCR-ZERO :Q> G BEEP :Q> Q MTB :Q> @ BEEP :Q> H BEEP :Q> R SCR-ZERO :Q> I BEEP :Q> S LEFT-END :Q> [ ZEXIT :Q> J Z-JOIN :Q> T Z-TOP IF CURSOR 1 \ ZEDIT Oct1986:gt : (Z) ( QUASH ) (MFY!) BEGIN KEY DUP BL < IF GO-CHAR ELSE IF CURSOR 1 C DL-TXT THEN Q; := A WORD-LEFT := K CHAR-UP := U Z-SPLIT := B BACK-SCREEN := L CHAR-RIGHT := V INS-TGL := C LIN-FCH := M NEXT-LINE := W KEEP-MODS := D CHAR-RIGHT := N NEXT-SCREEN := X CHAR-DOWN := E INSERT-CHAR := O OPEN-LINE := Y DEL-LINE := F WORD-RIGHT := P DEL-EOL := Z >SL := G DEL-CHAR := Q DROP-MODS := @ ALT-FCH := H CHAR-LEFT := R Z-JOIN := I TOP-LINE := J CHAR-DOWN := T DEL-WORD := [ ZEXIT := S ALT-SCREEN \ ZEDIT Oct1986:gt\ : clear-line ( x y -- ) 24 EMIT ; FORTH DEFINITIONS EDITOR ALSO : EDIT ['] NOOP IS (.LINE) 0 18 AT CLEAR-LINE EDIT (Z) ; : Z DEPTH IF SCR ! THEN SCR @ EDIT ; : FIX FIX (Z) ; \ ZEDIT Oct1986:gtclear-line is a kaypro sequence; faster than 80 spaces. I defered (.line) in utility.blk, then substituted (.line) for .line in .all. Following the .line definition make it (.line) -- ' .line is (.line). Next the changes in edit on scr 12 (zedit in the original), and in zexit were made, adding (.line) vector changes as appropriate. Edit makes noop (.line), while zexit re-makes it to be .line. the effect is to eliminate the line editors editing line (0 18) while in zedit, thus making it un-necessary to keep erasing it in .INSERTING. Its much neater, and isn't constantly flashing on then off. Set the root, forth, and editor vocabs to be searched and put new definitions in the editor vocab Load screens 2 through 12 Set root and forth for searching, put new def's in forth Inform loading completed \ ZEDIT Oct1986:gtInvoke your terminal word .all from utility.blk takes care of displaying the screen and the line editors editing line, usually line 18. It is vectored thru .screen. INSERTING inserting, or not flag Q; call edit-at; terminates def's that may have changed the cursor position CURSOR+1, CURSOR-1, CURSOR+, EDGE+? cursor movement and edge of screen check %ZEDIT Oct1986:gtNONBLANK move forward to next nonblank >BLANK move forward to next blank WORD+ move to next word (MFL!) redraw current line from cursor MFL! set up to execute (mfl!) after the caller completes. Sort of a dynamic deferred definition %ZEDIT Oct1986:gtclear-line 24 emit ; ( a kaypro escape sequence) .INSERTING insert, or not (MFY!) redraw modified areas of screen MFY! see mfl! comments WORD-LEFT move left one word WORD-RIGHT move right one word CHAR-LEFT move left on char CHAR-RIGHT move right one char CONSTANT L15 screen size, in lines - 1 CHAR-UP move up one line, same horiz position CHAR-DOWN move down one line, same horiz position NEXT-LINE move to beginning of next line (CR) TAB-RIGHT move to next tab stop %ZEDIT Oct1986:gtTOP-LINE move to line zero BOTTOM-LINE move to bottom line QUASH zero video buff to force redisplay if mods cancelled REPAINT redraw screen DROP-MODS un-update -- discard changes BACK-SCREEN go back to previous screen (scr @ 1-) ALT-SCREEN go to shadow screen NEXT-SCREEN go to next screen KEEP-MODS save-buffers INS-TGL toggles -- inserting, non-inserting ALT-FCH get same line from shadow LIN-FCH yank-back the line I just deleted, or changed >SL go to start of line (SL is a jap word) \ : sl col# negate c ; %ZEDIT Oct1986:gtDEL-LINE delete line DEL-EOL delete to end of line DL-TXT used by DEL-WORD DL-JN ditto DEL-WORD if cur is on a space, del to start of next word thus you can justify if cur on non-space, del to start of next word if all char to right of cur are spaces, then pull up (join) copy of next line DEL-CHAR del char and close up %ZEDIT Oct1986:gtPR-CH? is it a printable char? MAKE-ROOM open a space for insertion char may be lost to right, beep warns PUT-CHAR insert/overstrike current char Z-SPLIT split the current line at the cursor KEY-TBL space for the control key editing functions GO-CHAR execute control key while in editor := defining word to enter control key sequences into the key-tbl %ZEDIT Oct1986:gt ZKEY I don't know what this does ZEXIT exit editor (to line editor) see notes screen 12 or 13 QKEY-TBL see key-tbl Q-GO-CHAR :Q> see := SCR-PREVIOUS SCR-SAVE SCR @ SCR-PREVIOUS SWAP ! ; SCR-ZERO SCR-SAVE ZEXIT 0 EDIT ; SCR-PRIOR SCR-PREVIOUS @ SCR ! Q; E.O.F. SCR-SAVE CAPACITY 1- SCR ! Q; I think this is more of Johns stuff, mostly %ZEDIT Oct1986:gt Z-WIPE wipe INSERT-CHAR insert text LEFT-END RIGHT-END Z-JOIN join OPEN-LINE insert blank line under line cursor in on MTB empty buffers and go to editor Z-TOP go to line 0 INS-BUF write contents of insert-buffer to screen %ZEDIT Oct1986:gtMore of Johns stuff. After a ^Q uses this table. Its a way of expanding as well as customizing. %ZEDIT Oct1986:gt (Z) The editor loop A WORD-LEFT K CHAR-UP U Z-SPLIT B BACK-SCREEN L CHAR-RIGHT V INS-TGL C LIN-FCH M NEXT-LINE W KEEP-MODS D CHAR-RIGHT N NEXT-SCREEN X CHAR-DOWN E INSERT-CHAR O OPEN-LINE Y DEL-LINE F WORD-RIGHT P DEL-EOL Z >SL G DEL-CHAR Q DROP-MODS @ ALT-FCH H CHAR-LEFT R Z-JOIN I TOP-LINE J CHAR-DOWN T DEL-WORD [ ZEXIT ( escape) S ALT-SCREEN %ZEDIT Oct1986:gtclear-line a kaypro clear line sequence Put following if forth vocab, make editor avail for search EDIT edit the indicated screen Z edit the indicated screen, or last screen edited or listed FIX fix, see utility.blk \S Clear-line is a kaypro escape sequence; faster than 80 spaces. I defered (.line) in utility.blk, then substituted (.line) for .line in .all. Following the .line definition make it (.line) -- ' .line is (.line). Next the changes in edit above (zedit in the original), and in zexit were made. One makes noop (.line), while the other re-makes it to be .line. the effect is to eliminate the line editors editing line (0 18) while in zedit, thus making it un-necessary to keep erasing it in .INSERTING. Its much neater.