VolksForth/8086/msdos/cursor/ced.fb
2021-04-11 13:43:39 +02:00

9.0 KiB
Raw Blame History

\ Commandline EDitor f<>r volksFORTH rev. 3.80 UH 05feb89Dieses File enthaelt Definitionen, die es erm”glichen die Kommandozeile zu editieren. Es gibt eine Commandline History, die es erm”glicht alte Eingaben wiederzuholen. Diese werden zyklisch auf Screen 0 im File History gesichert und bleiben so auch <20>ber ein SAVESYSTEM erhalten. Tasten: Cursor links/rechts  Zeichen l”schen <del> und <- Zeile l”schen <esc> Einf<6E>gen an aus <ins> Zeile abschlieáen <enter> Anfang/Ende der Zeile <pos1> <end> alte Zeilen wiederholen   \ Commandline EDitor LOAD-Screen UH 20Nov87 jrg 14m„r89 : curleft ( -- ) at? 1- at ; : currite ( -- ) at? 1+ at ; 1 5 +thru \ Erweiterte Eingabe .( Kommandozeilen Editor geladen ) cr \ History -- Kommandogeschichte jrg 14m„r89makefile history 1 more | Variable line# line# off | Variable lastline# lastline# off | : 'history ( n -- addr ) pushfile history c/l * b/blk /mod block + ; | : @line ( n -- addr len ) 'history c/l -trailing ; | : !history ( addr line# -- ) 'history dup c/l blank span @ c/l min cmove update ; | : @history ( addr line# -- ) @line rot swap dup span ! cmove ; | : +line ( n addr -- ) dup @ rot + l/s mod swap ! ; \ Ende der Eingabe jrg 18dez89 | Variable maxchars | Variable cinsert cinsert on | : -text ( a1 a2 l -- 0=equal ) bounds ?DO count I c@ - ?dup IF nip ENDLOOP exit THEN LOOP 0= ; | : done ( a p1 -- a p2 ) 2dup at? rot - span @ dup maxchars ! + at space blankline line# @ @line span @ = IF span @ -text 0=exit 2dup THEN drop lastline# @ !history 1 lastline# +line ; \ Erweiterte Eingabe UH 08OCt87 jrg 19dez89 : redisplay ( addr pos -- ) at? 2swap span @ swap /string type blankline at ; | : del ( addr pos -- ) span @ 0=exit dup >r + dup 1+ swap span @ r> - cmove -1 span +! ; | : ins ( addr pos1 -- ) dup >r + dup dup 1+ span @ r> - cmove> bl swap c! 1 span +! ; | : delete ( a p1 -- a p2 ) 2dup del 2dup redisplay ; | : back ( a p1 -- a p2 ) 1- curleft delete ; | : recall ( a p1 -- a p2 ) at? rot - at dup line# @ @history dup 0 redisplay at? span @ + at span @ ; | : <start ( a1 p1 -- a2 p2 ) at? rot - at 0 ; \ Tastenbelegung f<>r Zeilen-Editor MS/DOS ks jrg 19dez89 : (decode ( addr pos1 key -- addr pos2 ) -&77 case? IF dup span @ < 0=exit currite 1+ exit THEN -&75 case? IF dup 0=exit curleft 1- exit THEN -&82 case? IF cinsert @ 0= cinsert ! exit THEN #bs case? IF dup 0=exit back exit THEN -&83 case? IF span @ 2dup < and 0=exit delete exit THEN -&72 case? IF -1 line# +line recall exit THEN -&80 case? IF 1 line# +line recall exit THEN #cr case? IF done exit THEN #esc case? IF <start span off 2dup redisplay exit THEN -&71 case? IF <start exit THEN -&79 case? IF at? rot - span @ + at span @ exit THEN dup emit >r cinsert @ IF 2dup ins THEN 2dup + r> swap c! 1+ dup span @ max span ! 2dup redisplay ; \ Patch UH 08Oct87 jrg 19dez89 : showcur ( -- ) curshape? swap drop \ bot top cinsert @ IF dup 2/ \ top = bot/2 ELSE dup 1- THEN swap curshape ; : (expect ( addr len -- ) maxchars ! span off lastline# @ line# ! 0 BEGIN span @ maxchars @ u< WHILE key decode showcur REPEAT 2drop ; ' (decode ' keyboard 6 + ! ' (expect ' keyboard 8 + !