]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.tools.operations: use without-limits for unparse and add copy object
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 2 Feb 2022 06:14:04 +0000 (00:14 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 2 Feb 2022 06:29:36 +0000 (00:29 -0600)
For large JSON objects, unparsing would show ~2600 more~ instead of all
of the text. Also realized I could add a copy command to unparse into
the clipboard directly

Use ... for prettyprint

basis/ui/tools/operations/operations.factor

index c31492833bb6239b776a22e5c41c39375cdf94c3..c2019b60c42ac5abc4025f80258137b08bd3a18a 100644 (file)
@@ -3,9 +3,10 @@
 USING: accessors combinators.short-circuit compiler.errors
 compiler.units continuations definitions destructors editors
 help.topics io.pathnames io.styles kernel libc.private
-macros.expander models parser prettyprint quotations see
-source-files.errors stack-checker threads tools.annotations
-tools.crossref tools.test tools.time tools.walker ui.commands
+macros.expander models namespaces parser prettyprint
+prettyprint.config quotations see source-files.errors
+stack-checker threads tools.annotations tools.crossref
+tools.test tools.time tools.walker ui.clipboards ui.commands
 ui.gestures ui.operations ui.tools.browser ui.tools.deploy
 ui.tools.inspector ui.tools.listener ui.tools.traceback vocabs
 vocabs.loader vocabs.parser words ;
@@ -16,7 +17,7 @@ IN: ui.tools.operations
     { +primary+ t }
 } define-operation
 
-: com-prettyprint ( obj -- ) . ;
+: com-prettyprint ( obj -- ) ... ;
 
 [ drop t ] \ com-prettyprint H{
     { +listener+ t }
@@ -28,10 +29,14 @@ IN: ui.tools.operations
     { +listener+ t }
 } define-operation
 
-: com-unparse ( obj -- ) unparse listener-input ;
+: com-unparse ( obj -- ) [ unparse listener-input ] without-limits ;
 
 [ drop t ] \ com-unparse H{ } define-operation
 
+: com-copy-object ( obj -- ) [ unparse clipboard get set-clipboard-contents ] without-limits ;
+
+[ drop t ] \ com-copy-object H{ } define-operation
+
 ! Models
 [ { [ model? ] [ ref>> ] } 1&& ] \ inspect-model H{
     { +primary+ t }