diff --git a/library/bootstrap/boot-stage3.factor b/library/bootstrap/boot-stage3.factor index 46c4764d04..d28cabfad8 100644 --- a/library/bootstrap/boot-stage3.factor +++ b/library/bootstrap/boot-stage3.factor @@ -62,7 +62,6 @@ t [ "/library/eval-catch.factor" "/library/tools/listener.factor" - "/library/io/ansi.factor" "/library/tools/word-tools.factor" "/library/syntax/see.factor" "/library/test/test.factor" diff --git a/library/cli.factor b/library/cli.factor index 59521fc017..6a5406ca52 100644 --- a/library/cli.factor +++ b/library/cli.factor @@ -55,7 +55,7 @@ sequences strings ; #! -no- CLI switch "user-init" on "compile" on - os "win32" = "ui" "ansi" ? "shell" set ; + os "win32" = "ui" "tty" ? "shell" set ; : parse-command-line ( -- ) #! Parse command line arguments. diff --git a/library/io/ansi.factor b/library/io/ansi.factor deleted file mode 100644 index 6d80233cf3..0000000000 --- a/library/io/ansi.factor +++ /dev/null @@ -1,53 +0,0 @@ -! Copyright (C) 2004, 2005 Slava Pestov. -! See http://factor.sf.net/license.txt for BSD license. -IN: ansi -USING: lists kernel namespaces io strings -presentation generic sequences ; - -! raps the given stream in an ANSI stream. ANSI -! streams support the following character attributes: -! bold - if not f, text is boldface. -! ansi-fg - foreground color -! ansi-bg - background color - -! black 0 -! red 1 -! green 2 -! yellow 3 -! blue 4 -! magenta 5 -! cyan 6 -! white 7 - -TUPLE: ansi-stream ; -C: ansi-stream ( stream -- stream ) [ set-delegate ] keep ; - -: reset ( -- code ) - #! Reset ANSI color codes. - "\e[0m" ; inline - -: bold ( -- code ) - #! Switch on boldface. - "\e[1m" ; inline - -: fg ( color -- code ) - #! Set foreground color. - "\e[3" swap "m" append3 ; inline - -: bg ( color -- code ) - #! Set foreground color. - "\e[4" swap "m" append3 ; inline - -: ansi-attrs ( style -- ) - "bold" over assoc [ bold , ] when - "ansi-fg" over assoc [ fg , ] when* - "ansi-bg" swap assoc [ bg , ] when* ; - -M: ansi-stream stream-write-attr ( string style stream -- ) - >r [ ansi-attrs , reset , ] make-string r> - delegate stream-write ; - -IN: shells - -: ansi - stdio [ ] change tty ; diff --git a/library/syntax/see.factor b/library/syntax/see.factor index 7a13b41fb0..52f9a9474f 100644 --- a/library/syntax/see.factor +++ b/library/syntax/see.factor @@ -37,8 +37,6 @@ streams strings styles unparser words ; : comment-style #! Feel free to redefine this! [ - [[ "ansi-fg" "0" ]] - [[ "ansi-bg" "2" ]] [[ "fg" [ 255 0 0 ] ]] [[ foreground [ 192 0 0 ] ]] ] ; diff --git a/library/tools/listener.factor b/library/tools/listener.factor index bf3fb64c5b..be84cc157d 100644 --- a/library/tools/listener.factor +++ b/library/tools/listener.factor @@ -1,24 +1,13 @@ ! Copyright (C) 2003, 2005 Slava Pestov. ! See http://factor.sf.net/license.txt for BSD license. IN: listener -USING: ansi errors io kernel lists math memory namespaces parser +USING: errors io kernel lists math memory namespaces parser presentation sequences strings styles unparser vectors words ; -SYMBOL: cont-prompt SYMBOL: listener-prompt SYMBOL: quit-flag -global [ - "..." cont-prompt set - "ok" listener-prompt set -] bind - -: prompt. ( text -- ) - [ [[ "bold" t ]] [[ font-style bold ]] ] write-attr - ! Print the space without a style, to workaround a bug in - ! the GUI listener where the style from the prompt carries - ! over to the input - bl flush ; +global [ " " listener-prompt set ] bind : bye ( -- ) #! Exit the current listener. @@ -30,8 +19,7 @@ global [ (parse) depth r> dup >r <= [ ( we're done ) r> drop t ] [ - ( more input needed ) r> cont-prompt get prompt. - (read-multiline) + ( more input needed ) r> (read-multiline) ] ifte ] [ ( EOF ) r> 2drop f @@ -44,8 +32,8 @@ global [ : listen ( -- ) #! Wait for user input, and execute. - listener-prompt get prompt. - [ read-multiline [ call ] [ bye ] ifte ] try ; + listener-prompt get write flush + [ read-multiline [ terpri flush call ] [ bye ] ifte ] try ; : listener ( -- ) #! Run a listener loop that executes user input. diff --git a/library/tools/walker.factor b/library/tools/walker.factor index f956a878a4..4d925502cd 100644 --- a/library/tools/walker.factor +++ b/library/tools/walker.factor @@ -60,7 +60,7 @@ sequences io strings vectors words ; \ bye word. " -- exit single-stepper" print report ; -: walk-listener walk-banner "walk" listener-prompt set listener ; +: walk-listener walk-banner "walk " listener-prompt set listener ; : init-walk ( quot callstack namestack -- ) init-interpreter