]> gitweb.factorcode.org Git - factor.git/commitdiff
Working on new UI
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 11 Dec 2008 22:47:38 +0000 (16:47 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 11 Dec 2008 22:47:38 +0000 (16:47 -0600)
18 files changed:
basis/help/markup/markup.factor
basis/help/topics/topics.factor
basis/prettyprint/prettyprint.factor
basis/tools/apropos/apropos-docs.factor [new file with mode: 0644]
basis/tools/apropos/apropos-tests.factor [new file with mode: 0644]
basis/tools/apropos/apropos.factor [new file with mode: 0644]
basis/tools/completion/completion.factor
basis/tools/crossref/crossref-docs.factor
basis/tools/crossref/crossref.factor
basis/tools/test/tools.factor [deleted file]
basis/tools/vocabs/browser/browser.factor
basis/ui/gadgets/editors/editors-tests.factor
basis/ui/gadgets/editors/editors.factor
basis/ui/tools/browser/browser.factor
basis/ui/tools/deploy/deploy.factor
basis/ui/tools/interactor/interactor.factor
basis/ui/tools/search/search.factor
core/parser/parser.factor

index a7501dc242615256f9d926c04a7930e7d4ecfc08..09712145184c08597ee71bf1d357dbdc63fd0b24 100644 (file)
@@ -356,4 +356,7 @@ M: array elements*
     ] H{ } make-assoc keys ;
 
 : <$link> ( topic -- element )
-    \ $link swap 2array ;
+    1array \ $link prefix ;
+
+: <$snippet> ( str -- element )
+    1array \ $snippet prefix ;
index e6b19d5baae1866acd6e84bb1c299a2e4ff9a2c1..9b5aaa78122cc478fc065dda39a4b7d29ae5217d 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2005, 2007 Slava Pestov.
+! Copyright (C) 2005, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.x
 USING: accessors arrays definitions generic assocs
 io kernel namespaces make prettyprint prettyprint.sections
@@ -21,7 +21,7 @@ PREDICATE: word-link < link name>> word? ;
 M: link summary
     [
         "Link: " %
-        name>> dup word? [ summary ] [ unparse ] if %
+        name>> dup word? [ summary ] [ unparse-short ] if %
     ] "" make ;
 
 ! Help articles
index 9d5af9e6a5afaeb47499a88cd248460d884d16d2..50c522e25556a40c84429c37fb43335eaf7e645c 100644 (file)
@@ -234,15 +234,6 @@ M: pathname synopsis* pprint* ;
 
 M: word summary synopsis ;
 
-: synopsis-alist ( definitions -- alist )
-    [ dup synopsis swap ] { } map>assoc ;
-
-: definitions. ( alist -- )
-    [ write-object nl ] assoc-each ;
-
-: sorted-definitions. ( definitions -- )
-    synopsis-alist sort-keys definitions. ;
-
 GENERIC: declarations. ( obj -- )
 
 M: object declarations. drop ;
diff --git a/basis/tools/apropos/apropos-docs.factor b/basis/tools/apropos/apropos-docs.factor
new file mode 100644 (file)
index 0000000..b50b51b
--- /dev/null
@@ -0,0 +1,6 @@
+IN: tools.apropos
+USING: help.markup help.syntax strings ;
+
+HELP: apropos
+{ $values { "str" string } }
+{ $description "Lists all words, vocabularies and help articles whose name contains a subsequence equal to " { $snippet "str" } ". Results are ranked using a simple distance algorithm." } ;
diff --git a/basis/tools/apropos/apropos-tests.factor b/basis/tools/apropos/apropos-tests.factor
new file mode 100644 (file)
index 0000000..96ce9d3
--- /dev/null
@@ -0,0 +1,4 @@
+IN: tools.apropos.tests
+USING: tools.apropos tools.test ;
+
+[ ] [ "swp" apropos ] unit-test
diff --git a/basis/tools/apropos/apropos.factor b/basis/tools/apropos/apropos.factor
new file mode 100644 (file)
index 0000000..e271c62
--- /dev/null
@@ -0,0 +1,72 @@
+! Copyright (C) 2008 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors arrays assocs fry help.markup help.topics io
+kernel make math math.parser namespaces sequences sorting
+summary tools.completion tools.vocabs tools.vocabs.browser
+vocabs words unicode.case help ;
+IN: tools.apropos
+
+: $completions ( seq -- )
+    dup [ word? ] all? [ words-table ] [
+        dup [ vocab-spec? ] all? [
+            $vocabs
+        ] [
+            [ <$link> ] map $list
+        ] if
+    ] if ;
+
+TUPLE: more-completions seq ;
+
+: max-completions 5 ;
+
+M: more-completions article-title article-name ;
+
+M: more-completions article-name
+    seq>> length max-completions - number>string " more results" append ;
+
+M: more-completions article-content
+    seq>> sort-values keys \ $completions prefix ;
+
+M: more-completions summary article-title ;
+
+: (apropos) ( str candidates title -- element )
+    [
+        [ completions ] dip '[
+            _ 1array \ $heading prefix ,
+            [ max-completions short head keys \ $completions prefix , ]
+            [ dup length max-completions > [ more-completions boa 1array \ $link prefix , ] [ drop ] if ]
+            bi
+        ] unless-empty
+    ] { } make ;
+
+: word-candidates ( words -- candidates )
+    [ dup name>> >lower ] { } map>assoc ;
+
+: vocab-candidates ( -- candidates )
+    all-vocabs-seq [ dup vocab-name >lower ] { } map>assoc ;
+
+: help-candidates ( seq -- candidates )
+    [ dup >link swap article-title >lower ] { } map>assoc
+    sort-values ;
+
+: $apropos ( str -- )
+    first
+    [ all-words word-candidates "Words" (apropos) ]
+    [ vocab-candidates "Vocabularies" (apropos) ]
+    [ articles get keys help-candidates "Help articles" (apropos) ]
+    tri 3array print-element ;
+
+TUPLE: apropos search ;
+
+C: <apropos> apropos
+
+M: apropos article-title
+    search>> "Search results for ``" "''" surround ;
+
+M: apropos article-name article-title ;
+
+M: apropos article-content
+    search>> 1array \ $apropos prefix ;
+
+: apropos ( str -- )
+    <apropos> print-topic ;
index 084b97970d63e00ffc260fda7c6f69b13f55adcf..55e58ebf146418c45f9ed1374bc425f429cc54fb 100644 (file)
@@ -1,12 +1,12 @@
 ! Copyright (C) 2005, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel arrays sequences math namespaces strings io
+USING: kernel arrays sequences math namespaces strings io fry
 vectors words assocs combinators sorting unicode.case
 unicode.categories math.order ;
 IN: tools.completion
 
 : (fuzzy) ( accum ch i full -- accum i ? )
-    index-from 
+    index-from
     [
         [ swap push ] 2keep 1+ t
     ] [
@@ -61,18 +61,12 @@ IN: tools.completion
     dupd fuzzy score max ;
 
 : completion ( short candidate -- result )
-    [ second >lower swap complete ] keep first 2array ;
+    [ second >lower swap complete ] keep 2array ;
 
 : completions ( short candidates -- seq )
-    over empty? [
-        nip [ first ] map
-    ] [
-        [ >lower ] dip [ completion ] with map
-        rank-completions
-    ] if ;
-
-: string-completions ( short strs -- seq )
-    dup zip completions ;
+    [ '[ _ ] ]
+    [ '[ >lower _ [ completion ] with map rank-completions ] ] bi
+    if-empty ;
 
 : limited-completions ( short candidates -- seq )
     [ completions ] [ drop ] 2bi
index b7ec0d07a2af2f7fa71f1de243677e9d36b1e2a4..820c957cbc3b3c54ad5e1d4e0afdafb87690041d 100644 (file)
@@ -3,7 +3,6 @@ IN: tools.crossref
 
 ARTICLE: "tools.crossref" "Cross-referencing tools" 
 { $subsection usage. }
-{ $subsection apropos }
 { $see-also "definitions" "words" see see-methods } ;
 
 ABOUT: "tools.crossref"
@@ -14,7 +13,3 @@ HELP: usage.
 { $examples { $code "\\ reverse usage." } } ;
 
 { usage usage. } related-words
-
-HELP: apropos
-{ $values { "str" "a string" } }
-{ $description "Lists all words whose name contains a subsequence equal to " { $snippet "str" } ". Results are ranked using a simple distance algorithm." } ;
index c4b046ecccb26d87479119166fbac44d30806fe9..494e022243f5afd269808281f9fb6d90380a6ab2 100644 (file)
@@ -1,16 +1,17 @@
-! Copyright (C) 2005, 2007 Slava Pestov.
+! Copyright (C) 2005, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays definitions assocs io kernel
-math namespaces prettyprint sequences strings io.styles words
-generic tools.completion quotations parser summary
-sorting hashtables vocabs parser source-files ;
+USING: assocs definitions io io.styles kernel prettyprint
+sorting ;
 IN: tools.crossref
 
-: usage. ( word -- )
-    smart-usage sorted-definitions. ;
+: synopsis-alist ( definitions -- alist )
+    [ dup synopsis swap ] { } map>assoc ;
+
+: definitions. ( alist -- )
+    [ write-object nl ] assoc-each ;
 
-: words-matching ( str -- seq )
-    all-words [ dup name>> ] { } map>assoc completions ;
+: sorted-definitions. ( definitions -- )
+    synopsis-alist sort-keys definitions. ;
 
-: apropos ( str -- )
-    words-matching synopsis-alist reverse definitions. ;
+: usage. ( word -- )
+    smart-usage sorted-definitions. ;
diff --git a/basis/tools/test/tools.factor b/basis/tools/test/tools.factor
deleted file mode 100644 (file)
index bf74c1a..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-IN: tools.test.tests
-USING: completion words sequences test ;
-
-[ ] [ "swp" apropos ] unit-test
-[ f ] [ "swp" words-matching empty? ] unit-test
index e9e8d27870704378c223bc9e53acbbd7e71937c3..8b3292e3ac1a1b72c2220788d2ed61ebe65d038c 100644 (file)
@@ -11,42 +11,32 @@ IN: tools.vocabs.browser
 
 : vocab-status-string ( vocab -- string )
     {
-        { [ dup not ] [ drop "" ] }
+        { [ dup vocab not ] [ drop "" ] }
         { [ dup vocab-main ] [ drop "[Runnable]" ] }
         [ drop "[Loaded]" ]
     } cond ;
 
-: write-status ( vocab -- )
-    vocab vocab-status-string write ;
+: vocab-row ( vocab -- row )
+    [ <$link> ] [ vocab-status-string ] [ vocab-summary ] tri
+    3array ;
 
-: vocab. ( vocab -- )
-    [
-        [ [ write-status ] with-cell ]
-        [ [ ($link) ] with-cell ]
-        [ [ vocab-summary write ] with-cell ] tri
-    ] with-row ;
-
-: vocab-headings. ( -- )
-    [
-        [ "State" write ] with-cell
-        [ "Vocabulary" write ] with-cell
-        [ "Summary" write ] with-cell
-    ] with-row ;
+: vocab-headings ( -- headings )
+    {
+        { $strong "Vocabulary" }
+        { $strong "State" }
+        { $strong "Summary" }
+    } ;
 
-: root-heading. ( root -- )
+: root-heading ( root -- )
     [ "Children from " prepend ] [ "Children" ] if*
     $heading ;
 
-: $vocabs ( assoc -- )
+: $vocabs ( seq -- )
+    [ vocab-row ] map vocab-headings prefix $table ;
+
+: $vocab-roots ( assoc -- )
     [
-        [ drop ] [
-            [ root-heading. ]
-            [
-                standard-table-style [
-                    vocab-headings. [ vocab. ] each
-                ] ($grid)
-            ] bi*
-        ] if-empty
+        [ drop ] [ [ root-heading ] [ $vocabs ] bi* ] if-empty
     ] assoc-each ;
 
 TUPLE: vocab-tag name ;
@@ -74,7 +64,7 @@ C: <vocab-author> vocab-author
     ] unless-empty ;
 
 : describe-children ( vocab -- )
-    vocab-name all-child-vocabs $vocabs ;
+    vocab-name all-child-vocabs $vocab-roots ;
 
 : describe-files ( vocab -- )
     vocab-files [ <pathname> ] map [
@@ -94,7 +84,7 @@ C: <vocab-author> vocab-author
         [
             [ <$link> ]
             [ superclass <$link> ]
-            [ "slots" word-prop [ name>> ] map " " join \ $snippet swap 2array ]
+            [ "slots" word-prop [ name>> ] map " " join <$snippet> ]
             tri 3array
         ] map
         { { $strong "Class" } { $strong "Superclass" } { $strong "Slots" } } prefix
@@ -161,24 +151,24 @@ C: <vocab-author> vocab-author
         "Parsing words" $subheading
         [
             [ <$link> ]
-            [ word-syntax dup [ \ $snippet swap 2array ] when ]
+            [ word-syntax dup [ <$snippet> ] when ]
             bi 2array
         ] map
         { { $strong "Word" } { $strong "Syntax" } } prefix
         $table
     ] unless-empty ;
 
+: words-table ( words -- )
+    [
+        [ <$link> ]
+        [ stack-effect dup [ effect>string <$snippet> ] when ]
+        bi 2array
+    ] map
+    { { $strong "Word" } { $strong "Stack effect" } } prefix
+    $table ;
+
 : (describe-words) ( words heading -- )
-    '[
-        _ $subheading
-        [
-            [ <$link> ]
-            [ stack-effect dup [ effect>string \ $snippet swap 2array ] when ]
-            bi 2array
-        ] map
-        { { $strong "Word" } { $strong "Stack effect" } } prefix
-        $table
-    ] unless-empty ;
+    '[ _ $subheading words-table ] unless-empty ;
 
 : describe-generics ( words -- )
     "Generic words" (describe-words) ;
@@ -201,8 +191,8 @@ C: <vocab-author> vocab-author
         [ <$link> 1array ] map $table
     ] unless-empty ;
 
-: describe-words ( vocab -- )
-    words [
+: $words ( words -- )
+    [
         "Words" $heading
 
         natural-sort
@@ -229,7 +219,7 @@ C: <vocab-author> vocab-author
 
 : words. ( vocab -- )
     last-element off
-    vocab-name describe-words ;
+    words $words ;
 
 : describe-metadata ( vocab -- )
     [
@@ -239,11 +229,11 @@ C: <vocab-author> vocab-author
     ] { } make
     [ "Meta-data" $heading $table ] unless-empty ;
 
-: $describe-vocab ( element -- )
+: $vocab ( element -- )
     first {
         [ describe-help ]
         [ describe-metadata ]
-        [ describe-words ]
+        [ words $words ]
         [ describe-files ]
         [ describe-children ]
     } cleave ;
@@ -262,10 +252,10 @@ C: <vocab-author> vocab-author
     [ vocab-authors ] keyed-vocabs ;
 
 : $tagged-vocabs ( element -- )
-    first tagged $vocabs ;
+    first tagged $vocab-roots ;
 
 : $authored-vocabs ( element -- )
-    first authored $vocabs ;
+    first authored $vocab-roots ;
 
 : $all-tags ( element -- )
     drop "Tags" $heading all-tags $tags ;
@@ -282,7 +272,7 @@ M: vocab-spec article-title vocab-name " vocabulary" append ;
 M: vocab-spec article-name vocab-name ;
 
 M: vocab-spec article-content
-    vocab-name \ $describe-vocab swap 2array ;
+    vocab-name \ $vocab swap 2array ;
 
 M: vocab-spec article-parent drop "vocab-index" ;
 
index 274d62ea46564a44a1eb647c146ee4ad3cf580a6..eda3e39b07e4fe6d8dcc5ab4d1d088008e08cbed 100644 (file)
@@ -43,7 +43,7 @@ IN: ui.gadgets.editors.tests
 
 \ <editor> must-infer
 
-"hello" <model> <field> "field" set
+"hello" <model> <model-field> "field" set
 
 "field" get [
     [ "hello" ] [ "field" get field-model>> value>> ] unit-test
index 72d5900c281fd602b2191d765efd097b77ba7874..26024c874dd6b1c1ce7089120dc70069a0121f89 100755 (executable)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2006, 2008 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays documents kernel math models
-namespaces locals fry make opengl opengl.gl sequences strings
-io.styles math.vectors sorting colors combinators assocs
-math.order fry calendar alarms ui.clipboards ui.commands
+USING: accessors arrays documents kernel math models namespaces
+locals fry make opengl opengl.gl sequences strings io.styles
+math.vectors sorting colors combinators assocs math.order fry
+calendar alarms continuations ui.clipboards ui.commands
 ui.gadgets ui.gadgets.borders ui.gadgets.buttons
 ui.gadgets.labels ui.gadgets.scrollers ui.gadgets.theme
 ui.gadgets.menus ui.gadgets.wrappers ui.render ui.gestures
@@ -452,6 +452,10 @@ editor "caret-motion" f {
     { T{ key-down f { C+ } "END" } end-of-document }
 } define-command-map
 
+: clear-editor ( editor -- )
+    #! The with-datastack is a kludge to make it infer. Stupid.
+    model>> 1array [ clear-doc ] with-datastack drop ;
+
 : select-all ( editor -- ) T{ doc-elt } select-elt ;
 
 : select-line ( editor -- ) T{ one-line-elt } select-elt ;
@@ -537,8 +541,8 @@ TUPLE: source-editor < multiline-editor ;
 : <source-editor> ( -- editor )
     source-editor new-editor ;
 
-! Fields wrap an editor and edit an external model
-TUPLE: field < wrapper field-model editor ;
+! Fields wrap an editor
+TUPLE: field < wrapper editor min-width max-width ;
 
 : field-theme ( gadget -- gadget )
     gray <solid> >>boundary ; inline
@@ -548,18 +552,45 @@ TUPLE: field < wrapper field-model editor ;
         { 1 0 } >>fill
         field-theme ;
 
-: <field> ( model -- gadget )
-    <editor> dup <field-border> field new-wrapper
-        swap >>editor
-        swap >>field-model ;
+: new-field ( class -- gadget )
+    [ <editor> dup <field-border> ] dip new-wrapper swap >>editor ; inline
+
+: column-width ( editor n -- width )
+    [ editor>> editor-font* ] dip CHAR: \s <string> string-width ;
+
+M: field pref-dim*
+    [ call-next-method ]
+    [ dup min-width>> dup [ column-width 0 2array vmax ] [ 2drop ] if ]
+    [ dup max-width>> dup [ column-width 1/0. 2array vmin ] [ 2drop ] if ]
+    tri ;
+
+TUPLE: model-field < field field-model ;
+
+: <model-field> ( model -- gadget )
+    model-field new-field swap >>field-model ;
 
-M: field graft*
+M: model-field graft*
     [ [ field-model>> value>> ] [ editor>> ] bi set-editor-string ]
     [ dup editor>> model>> add-connection ]
     bi ;
 
-M: field ungraft*
+M: model-field ungraft*
     dup editor>> model>> remove-connection ;
 
-M: field model-changed
+M: model-field model-changed
     nip [ editor>> editor-string ] [ field-model>> ] bi set-model ;
+
+TUPLE: action-field < field quot ;
+
+: <action-field> ( quot -- gadget )
+    action-field new-field swap >>quot ;
+
+: invoke-action-field ( field -- )
+    [ editor>> editor-string ]
+    [ editor>> clear-editor ]
+    [ quot>> ]
+    tri call ;
+
+action-field H{
+    { T{ key-down f f "RET" } [ invoke-action-field ] }
+} set-gestures
index becb401fa618e234a01f11548d4e956e8b126538..2018d5b622643933e6c54b4bd72c119f40b4b382 100644 (file)
@@ -1,15 +1,16 @@
 ! Copyright (C) 2006, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: debugger ui.tools.workspace help help.topics kernel
-models models.history ui.commands ui.gadgets ui.gadgets.panes
-ui.gadgets.scrollers ui.gadgets.tracks ui.gestures
-ui.gadgets.buttons compiler.units assocs words vocabs
-accessors fry combinators.short-circuit ;
+models models.history tools.apropos ui.commands ui.gadgets
+ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.tracks
+ui.gestures ui.gadgets.buttons ui.gadgets.packs
+ui.gadgets.editors ui.gadgets.labels models compiler.units
+assocs words vocabs accessors fry combinators.short-circuit ;
 IN: ui.tools.browser
 
 TUPLE: browser-gadget < track pane history ;
 
-: show-help ( link help -- )
+: show-help ( link browser-gadget -- )
     history>> dup add-history
     [ >link ] dip set-model ;
 
@@ -19,10 +20,23 @@ TUPLE: browser-gadget < track pane history ;
 : init-history ( browser-gadget -- )
     "handbook" >link <history> >>history drop ;
 
+: search-browser ( string browser -- )
+    [ <apropos> ] dip show-help ;
+
+: <search-field> ( browser -- field )
+    '[ _ search-browser ] <action-field> 10 >>min-width 10 >>max-width ;
+
+: <browser-toolbar> ( browser -- toolbar )
+    <shelf>
+        { 5 5 } >>gap
+        over <toolbar> add-gadget
+        "Search:" <label> add-gadget
+        swap <search-field> add-gadget ;
+
 : <browser-gadget> ( -- gadget )
     { 0 1 } browser-gadget new-track
         dup init-history
-        add-toolbar
+        dup <browser-toolbar> f track-add
         dup <help-pane> >>pane
         dup pane>> <scroller> 1 track-add ;
 
@@ -60,8 +74,6 @@ M: browser-gadget definitions-changed ( assoc browser -- )
 
 : com-documentation ( browser -- ) "handbook" swap show-help ;
 
-: com-vocabularies ( browser -- ) "vocab-index" swap show-help ;
-
 : browser-help ( -- ) "ui-browser" help-window ;
 
 \ browser-help H{ { +nullary+ t } } define-command
@@ -70,7 +82,6 @@ browser-gadget "toolbar" f {
     { T{ key-down f { A+ } "LEFT" } com-back }
     { T{ key-down f { A+ } "RIGHT" } com-forward }
     { f com-documentation }
-    { f com-vocabularies }
     { T{ key-down f f "F1" } browser-help }
 } define-command-map
 
index f233c9f162891882de8588405fb2804ce2790325..b98fd789886d2fe1e3f5bd0f213ab655d63869d3 100644 (file)
@@ -11,7 +11,7 @@ IN: ui.tools.deploy
 TUPLE: deploy-gadget < pack vocab settings ;
 
 : bundle-name ( parent -- parent )
-    deploy-name get <field>
+    deploy-name get <model-field>
     "Executable name:" label-on-left add-gadget ;
 
 : deploy-ui ( parent -- parent )
index 51425b124d0afffb64ddc73cc9dfad41c15206f2..8d261d4a223723a04276a62f9a65f08dfd8a78c2 100644 (file)
@@ -81,15 +81,11 @@ M: interactor model-changed
 : interactor-continue ( obj interactor -- )
     mailbox>> mailbox-put ;
 
-: clear-input ( interactor -- )
-    #! The with-datastack is a kludge to make it infer. Stupid.
-    model>> 1array [ clear-doc ] with-datastack drop ;
-
 : interactor-finish ( interactor -- )
     [ editor-string ] keep
     [ interactor-input. ] 2keep
     [ add-interactor-history ] keep
-    clear-input ;
+    clear-editor ;
 
 : interactor-eof ( interactor -- )
     dup interactor-busy? [
@@ -181,5 +177,5 @@ M: interactor stream-read-quot
 
 interactor "interactor" f {
     { T{ key-down f f "RET" } evaluate-input }
-    { T{ key-down f { C+ } "k" } clear-input }
+    { T{ key-down f { C+ } "k" } clear-editor }
 } define-command-map
index cf980cfc234a57ba58fecb334d9d24ed96b808bc..89a5ccea84c222f519a99020404e014eca47ae9a 100644 (file)
@@ -3,12 +3,12 @@
 USING: accessors assocs help help.topics io.files io.styles
 kernel models models.delay models.filter namespaces prettyprint
 quotations sequences sorting source-files definitions strings
-tools.completion tools.crossref classes.tuple vocabs words
-vocabs.loader tools.vocabs unicode.case calendar locals
-ui.tools.interactor ui.tools.listener ui.tools.workspace
-ui.commands ui.gadgets ui.gadgets.editors ui.gadgets.lists
-ui.gadgets.scrollers ui.gadgets.tracks ui.gadgets.borders
-ui.gestures ui.operations ui ;
+tools.completion tools.apropos tools.crossref classes.tuple
+vocabs words vocabs.loader tools.vocabs unicode.case calendar
+locals fry ui.tools.interactor ui.tools.listener
+ui.tools.workspace ui.commands ui.gadgets ui.gadgets.editors
+ui.gadgets.lists ui.gadgets.scrollers ui.gadgets.tracks
+ui.gadgets.borders ui.gestures ui.operations ui ;
 IN: ui.tools.search
 
 TUPLE: live-search < track field list ;
@@ -55,7 +55,10 @@ search-field H{
 
 : init-search-model ( live-search seq limited? -- live-search )
     [ 2drop ]
-    [ [ limited-completions ] [ completions ] ? curry <search-model> ] 3bi
+    [
+        [ limited-completions ] [ completions ] ?
+        '[ _ @ [ first ] map ] <search-model>
+    ] 3bi
     >>model ; inline
 
 : <search-list> ( presenter live-search -- list )
@@ -84,9 +87,6 @@ M: live-search pref-dim* drop { 400 200 } ;
 : <definition-search> ( string words limited? -- gadget )
     [ definition-candidates ] dip [ synopsis ] <live-search> ;
 
-: word-candidates ( words -- candidates )
-    [ dup name>> >lower ] { } map>assoc ;
-
 : <word-search> ( string words limited? -- gadget )
     [ word-candidates ] dip [ synopsis ] <live-search> ;
 
@@ -104,10 +104,6 @@ M: live-search pref-dim* drop { 400 200 } ;
     [ "Words and methods using " swap name>> append ]
     bi show-titled-popup ;
 
-: help-candidates ( seq -- candidates )
-    [ dup >link swap article-title >lower ] { } map>assoc
-    sort-values ;
-
 : <help-search> ( string -- gadget )
     all-articles help-candidates
     f [ article-title ] <live-search> ;
@@ -134,9 +130,6 @@ M: live-search pref-dim* drop { 400 200 } ;
     [ "Source files in " swap vocab-name append ]
     bi show-titled-popup ;
 
-: vocab-candidates ( -- candidates )
-    all-vocabs-seq [ dup vocab-name >lower ] { } map>assoc ;
-
 : <vocab-search> ( string -- gadget )
     vocab-candidates f [ vocab-name ] <live-search> ;
 
@@ -145,7 +138,7 @@ M: live-search pref-dim* drop { 400 200 } ;
     "Vocabulary search" show-titled-popup ;
 
 : history-candidates ( seq -- candidates )
-    [ dup <input> swap >lower ] { } map>assoc ;
+    [ [ <input> ] [ >lower ] bi ] { } map>assoc ;
 
 : <history-search> ( string seq -- gadget )
     history-candidates
index 4586cfe34ec4614f055547815c2f6ca05c6ee073..a9b60acb078463a4ebc7f071f8d9d310cc36e11a 100644 (file)
@@ -209,7 +209,9 @@ SYMBOL: interactive-vocabs
     "strings"
     "syntax"
     "tools.annotations"
+    "tools.apropos"
     "tools.crossref"
+    "tools.disassembler"
     "tools.memory"
     "tools.profiler"
     "tools.test"