From 0776e02d0c766a65e5c1eda960c4b70822382568 Mon Sep 17 00:00:00 2001 From: slava Date: Fri, 29 Sep 2006 21:18:09 +0000 Subject: [PATCH] Editors now support the stream output protocol --- TODO.FACTOR.txt | 2 +- library/ui/load.factor | 2 ++ library/ui/test/editor.factor | 10 ++++++++++ library/ui/test/gadgets.factor | 7 +++++++ library/ui/text/editor.factor | 7 +++++++ 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 library/ui/test/editor.factor create mode 100644 library/ui/test/gadgets.factor diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index a2a5a332ef..4fe1ba1359 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,4 +1,5 @@ - auto-invoke code gc +- code gc sig11 - cocoa: support real redefinition - fix this: [ 1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10 11 11 11 113 ] . @@ -39,7 +40,6 @@ - services do not launch if factor not running - fix ui listener delay - editor: - - editor should support stream output protocol - double/triple click - autoscroll - transpose char/word/line diff --git a/library/ui/load.factor b/library/ui/load.factor index 26de58cffc..7f3a0b13d2 100644 --- a/library/ui/load.factor +++ b/library/ui/load.factor @@ -47,10 +47,12 @@ PROVIDE: library/ui { "tools/workspace.factor" "tools/operations.factor" } { + "test/gadgets.factor" "test/models.factor" "test/document.factor" "test/rectangles.factor" "test/fields.factor" "test/commands.factor" "test/panes.factor" + "test/editors.factor" } ; diff --git a/library/ui/test/editor.factor b/library/ui/test/editor.factor new file mode 100644 index 0000000000..49b671ce0f --- /dev/null +++ b/library/ui/test/editor.factor @@ -0,0 +1,10 @@ +USING: gadgets-text test kernel io definitions namespaces +gadgets ; + +[ t ] [ + "editor" set + "editor" get graft* + "editor" get [ \ = see ] with-stream + "editor" get editor-text [ \ = see ] string-out = + "editor" get ungraft* +] unit-test diff --git a/library/ui/test/gadgets.factor b/library/ui/test/gadgets.factor new file mode 100644 index 0000000000..a641b36b72 --- /dev/null +++ b/library/ui/test/gadgets.factor @@ -0,0 +1,7 @@ +IN: temporary +USING: gadgets test ; + +TUPLE: fooey ; + +[ ] [ set-gadget-delegate ] unit-test +[ ] [ f set-gadget-delegate ] unit-test diff --git a/library/ui/text/editor.factor b/library/ui/text/editor.factor index 6bacb3c6b8..1ebb8e5e1a 100644 --- a/library/ui/text/editor.factor +++ b/library/ui/text/editor.factor @@ -230,3 +230,10 @@ M: editor user-input* : set-editor-text ( str editor -- ) control-model set-doc-text ; + +! Editors support the stream output protocol +M: editor stream-write1 >r ch>string r> stream-write ; + +M: editor stream-write control-self user-input ; + +M: editor stream-close drop ;