]> gitweb.factorcode.org Git - factor.git/commitdiff
tools.completion: minor fix to complete against file-name, not full-path.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 23 Oct 2012 02:17:52 +0000 (19:17 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 23 Oct 2012 02:17:52 +0000 (19:17 -0700)
basis/tools/completion/completion.factor

index ba8cbdf6d5d1ed247ac21a97f081dbf33449b02e..4a0e6f88cd8319f17a51750dc3ff16e0c51823eb 100644 (file)
@@ -109,21 +109,21 @@ PRIVATE>
 
 <PRIVATE
 
-: directory-paths ( directory -- paths )
+: directory-paths ( directory -- alist )
     dup '[
         [
-            [ _ prepend-path ]
+            [ dup _ prepend-path ]
             [ file-info directory? [ path-separator append ] when ]
-            bi
-        ] map
+            bi swap
+        ] { } map>assoc
     ] with-directory-files ;
 
 PRIVATE>
 
 : paths-matching ( str -- seq )
-    dup file-directory [ ?head drop ] keep
+    dup file-directory [ ?head drop trim-head-separators ] keep
     dup { [ exists? ] [ file-info directory? ] } 1&&
-    [ directory-paths dup zip completions ] [ 2drop { } ] if ;
+    [ directory-paths completions ] [ 2drop { } ] if ;
 
 <PRIVATE