misc <menukey>-shift-o improvements

- always select the old text when opening the window

- loosen the matching algorithm so that each segment has
  only to match a prefix of the corresponding directory
  (e.g., drr/pri/ will show you all of the files in the
  drracket/private collections directories)

- fix a bug that shows up when the alternate racket text
  field is empty
This commit is contained in:
Robby Findler 2013-11-13 22:47:20 -06:00
parent 6e983482bb
commit 40daf651b3
2 changed files with 7 additions and 14 deletions

View File

@ -22,7 +22,9 @@
(list/c lcl/c lcp/c)))
(listof (list/c string? path?)))]))
(define (ignore? x) (member x '("compiled")))
(define (ignore? x)
(or (member x '("compiled"))
(regexp-match #rx"~$" x)))
(define (find-completions string #:alternate-racket [alternate-racket #f])
(find-completions/internal string
@ -36,12 +38,7 @@
(cond
[(null? segments) '()]
[else
(define reg (regexp
(string-append "^"
(regexp-quote (car segments))
(if (null? (cdr segments))
""
"$"))))
(define reg (regexp (string-append "^" (regexp-quote (car segments)))))
(filter (λ (line) (regexp-match reg (list-ref line 0)))
collection-dirs)]))
(define unsorted
@ -50,12 +47,7 @@
(cond
[(null? segments) candidates]
[else
(define reg (regexp (string-append
"^"
(regexp-quote (car segments))
(if (null? (cdr segments))
""
"$"))))
(define reg (regexp (string-append "^" (regexp-quote (car segments)))))
(define nexts
(for*/list ([key+candidate (in-list candidates)]
[candidate (in-value (list-ref key+candidate 1))]
@ -114,7 +106,7 @@
(list (path->string dir) (build-path pth dir)))]
[else '()])]))))
(define (alternate-racket-clcl/clcp alternate-racket)
(define (alternate-racket-clcl/clcp alternate-racket)
(define (use-current-racket n)
(values (current-library-collection-links)
(current-library-collection-paths)))

View File

@ -35,6 +35,7 @@
(define tf (new text-field% [parent dlg] [label #f]
[init-value init-value]
[callback (λ (tf evt) (tf-callback))]))
(send (send tf get-editor) set-position 0 (send (send tf get-editor) last-position))
(define lb (new list-box%
[parent dlg] [choices '()] [label #f]
[callback (λ (lb evt) (update-buttons))]))