Listener: don't display more than 10 stack elements (configurable with max-stack-items variable)
parent
e3d4b88e8f
commit
4d53cc1c5d
|
@ -56,6 +56,14 @@ SYMBOL: error-hook
|
||||||
|
|
||||||
[ print-error-and-restarts ] error-hook set-global
|
[ print-error-and-restarts ] error-hook set-global
|
||||||
|
|
||||||
|
SYMBOL: display-stacks?
|
||||||
|
|
||||||
|
t display-stacks? set-global
|
||||||
|
|
||||||
|
SYMBOL: max-stack-items
|
||||||
|
|
||||||
|
10 max-stack-items set-global
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
: title. ( string -- )
|
: title. ( string -- )
|
||||||
|
@ -74,14 +82,19 @@ SYMBOL: error-hook
|
||||||
] each
|
] each
|
||||||
] tabular-output
|
] tabular-output
|
||||||
] unless-empty ;
|
] unless-empty ;
|
||||||
|
|
||||||
SYMBOL: display-stacks?
|
: trimmed-stack. ( seq -- )
|
||||||
|
dup length max-stack-items get > [
|
||||||
t display-stacks? set-global
|
max-stack-items get cut*
|
||||||
|
[
|
||||||
|
[ length number>string "(" " more items)" surround ] keep
|
||||||
|
write-object nl
|
||||||
|
] dip
|
||||||
|
] when stack. ;
|
||||||
|
|
||||||
: stacks. ( -- )
|
: stacks. ( -- )
|
||||||
display-stacks? get [
|
display-stacks? get [
|
||||||
datastack [ nl "--- Data stack:" title. stack. ] unless-empty
|
datastack [ nl "--- Data stack:" title. trimmed-stack. ] unless-empty
|
||||||
] when ;
|
] when ;
|
||||||
|
|
||||||
: prompt. ( -- )
|
: prompt. ( -- )
|
||||||
|
|
Loading…
Reference in New Issue