Commit acbdda35 authored by Bernd Paysan's avatar Bernd Paysan

throw -56 in accept on ^d on empty line for quit - allows users of accept to...

throw -56 in accept on ^d on empty line for quit - allows users of accept to determine themselves how to deal with that
parent 82771839
......@@ -1115,6 +1115,7 @@ Ghost does-exec drop
Ghost extra-exec drop
Ghost no-to drop
Ghost post, drop
Ghost refill drop
Ghost :docol Ghost :doesjump Ghost :dodoes 2drop drop
Ghost :dovar Ghost dovar-vt Ghost dodoes-vt 2drop drop
......
......@@ -248,6 +248,10 @@ require utf-8.fs
cols dup screenw !@ - >r 2 pick dup screenw @ / r> * 0 max +
dup spaces linew ! .all .rest false ;
: xhide ( max span addr pos1 -- max span addr pos1 f )
linew @ xback-restore 2 pick dup spaces xback-restore
linew off false ;
\ In the following, addr max is the buffer, addr span is the current
\ string in the buffer, and pos1 is the cursor position in the buffer.
......@@ -295,7 +299,7 @@ Variable vt100-modifier
2 pick over <>
IF xforw drop (xdel) .all 2 spaces 2 linew +! .rest
ELSE bell THEN 0 ;
: xeof 2 pick over or 0= IF bye ELSE <xdel> THEN ;
: xeof 2 pick over or 0= IF -56 throw ELSE <xdel> THEN ;
: xfirst-pos ( max span addr pos1 -- max span addr 0 0 )
drop 0 .all .rest 0 ;
......@@ -355,6 +359,7 @@ Variable vt100-modifier
['] xretype ctrl L bindkey
['] next-line ctrl N bindkey
['] prev-line ctrl P bindkey
['] xhide ctrl Z bindkey \ press ctrl-L to reshow
['] (xenter) #lf bindkey
['] (xenter) #cr bindkey
['] xtab-expand #tab bindkey
......
......@@ -254,6 +254,10 @@ defer line-end-hook ( -- ) \ gforth
BEGIN refill WHILE interpret line-end-hook REPEAT
state @ warning" EOF reached while compiling" ;
: get-input ( -- flag ) \ gforth
\G read a line of input
['] refill catch -56 = IF bye THEN ;
: execute-parsing-named-file ( i*x wfileid filename-addr filename-u xt -- j*x )
>r push-file \ dup 2* cells included-files 2@ drop + 2@ type
loadfilename 2! loadfile !
......
......@@ -737,7 +737,7 @@ has? os [IF]
\ if stderr does not work either, already DoError causes a hang
-2 (bye)
endif [ [THEN] ]
refill WHILE
get-input WHILE
interpret prompt
REPEAT
bye ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment