mirror of
https://github.com/forth-ev/VolksForth.git
synced 2024-11-29 05:49:26 +00:00
1 line
8.0 KiB
Plaintext
1 line
8.0 KiB
Plaintext
|
\ Commandline EDitor for volksFORTH rev. 3.80 cas 10nov05This File contains definitions to create an editable Forth command line with history. The commandline histroy allows older commands to be recalled. These older commands will be stored in Screen 0 in a file called"history" and will be preserved even when calling SAVE-SYSTEM. Keys: Cursor left/right Delete Char <del> und <- Delete Line <esc> toggle Insert <ins> finish line <enter> Jump to Beginning/End of Line <pos1> <end> recall older commands \ Commandline EDitor LOAD-Screen cas 10nov05 : curleft ( -- ) at? 1- at ; : currite ( -- ) at? 1+ at ; 1 5 +thru \ enhanced Input .( Commandline Editor loaded ) cr \ History -- Commandhistory cas 10nov05makefile history 1 more | Variable line# line# off | Variable lastline# lastline# off | : 'history ( n -- addr ) isfile push 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 ! ; \ End of input cas 10nov05 | Variable maxchars | Variable insert insert 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 ;
|