Fixup accept extra CR.

This commit is contained in:
Brad Nelson
2022-06-07 23:56:14 -07:00
parent 298de57027
commit f2948cee9b
3 changed files with 3 additions and 8 deletions

View File

@ -103,16 +103,12 @@ e: test-accept
in: 1234567890xxxxxx in: 1234567890xxxxxx
pad 10 accept pad 10 accept
pad swap type cr pad swap type cr
out:\ --> 1234567890 out: --> 1234567890
out:cr!
out:cr
out: 1234567890 out: 1234567890
in: foo in: foo
pad 10 accept pad 10 accept
pad swap type cr pad swap type cr
out:\ --> foo out: --> foo
out:cr!
out:cr
out: foo out: foo
;e ;e

View File

@ -159,7 +159,7 @@ variable hld
( Input ) ( Input )
: raw.s depth 0 max for aft sp@ r@ cells - @ . then next ; : raw.s depth 0 max for aft sp@ r@ cells - @ . then next ;
variable echo -1 echo ! variable arrow -1 arrow ! 0 value wascr variable echo -1 echo ! variable arrow -1 arrow ! 0 value wascr
: *emit ( n -- ) dup emit 13 = if cr then ; : *emit ( n -- ) dup 13 = if drop cr else emit then ;
: ?echo ( n -- ) echo @ if *emit else drop then ; : ?echo ( n -- ) echo @ if *emit else drop then ;
: ?arrow. arrow @ if >r >r raw.s r> r> ." --> " then ; : ?arrow. arrow @ if >r >r raw.s r> r> ." --> " then ;
: *key ( -- n ) : *key ( -- n )

View File

@ -45,7 +45,6 @@ variable expect-used variable result-used
: result-type ( a n -- ) for aft dup c@ result-emit 1+ then next drop ; : result-type ( a n -- ) for aft dup c@ result-emit 1+ then next drop ;
: expected ( -- a n ) expect-buffer expect-used @ ; : expected ( -- a n ) expect-buffer expect-used @ ;
: resulted ( -- a n ) result-buffer result-used @ ; : resulted ( -- a n ) result-buffer result-used @ ;
: out:cr! 13 expect-emit ;
: out:cr 13 expect-emit nl expect-emit ; : out:cr 13 expect-emit nl expect-emit ;
: out:\ ( "line" -- ) nl parse expect-type ; : out:\ ( "line" -- ) nl parse expect-type ;
: out: ( "line" -- ) out:\ out:cr ; : out: ( "line" -- ) out:\ out:cr ;