ui.tools.listener: tried to simplify stream-read-quot and handle-interactive
parent
0795d21e46
commit
d15c5bced4
|
@ -336,30 +336,23 @@ M: object accept-completion-hook 2drop ;
|
||||||
error-continuation get
|
error-continuation get
|
||||||
debugger-popup ;
|
debugger-popup ;
|
||||||
|
|
||||||
: try-parse ( lines interactor -- quot/error/f )
|
: try-parse ( lines -- quot/f/error )
|
||||||
[ drop parse-lines-interactive ] [
|
[ read-quot-step ] [ nip ] recover ;
|
||||||
2nip
|
|
||||||
dup lexer-error? [
|
|
||||||
dup error>> unexpected-eof? [ drop f ] when
|
|
||||||
] when
|
|
||||||
] recover ;
|
|
||||||
|
|
||||||
: handle-interactive ( lines interactor -- quot/f ? )
|
: handle-interactive ( interactor lines -- quot/f )
|
||||||
[ nip ] [ try-parse ] 2bi {
|
try-parse dup quotation? [ nip ] [
|
||||||
{ [ dup quotation? ] [ nip t ] }
|
dup not [ drop insert-newline ] [
|
||||||
{ [ dup not ] [ drop insert-newline f f ] }
|
handle-parse-error
|
||||||
[ handle-parse-error f f ]
|
] if f
|
||||||
} cond ;
|
] if ;
|
||||||
|
|
||||||
M: interactor stream-read-quot
|
M: interactor stream-read-quot ( stream -- quot/f )
|
||||||
[ interactor-yield ] keep {
|
dup interactor-yield dup [ not ] [ callable? ] bi or
|
||||||
{ [ over not ] [ drop ] }
|
[ nip ] [
|
||||||
{ [ over callable? ] [ drop ] }
|
dupd handle-interactive dup quotation? [
|
||||||
[
|
swap interactor-finish
|
||||||
[ handle-interactive ] keep swap
|
] [ drop stream-read-quot ] if
|
||||||
[ interactor-finish ] [ nip stream-read-quot ] if
|
] if ;
|
||||||
]
|
|
||||||
} cond ;
|
|
||||||
|
|
||||||
: interactor-operation ( gesture interactor -- ? )
|
: interactor-operation ( gesture interactor -- ? )
|
||||||
[ token-model>> value>> ] keep word-at-caret
|
[ token-model>> value>> ] keep word-at-caret
|
||||||
|
|
Loading…
Reference in New Issue