diff --git a/scheme/browse-directory-list.scm b/scheme/browse-directory-list.scm index 6e8e4b6..6197851 100644 --- a/scheme/browse-directory-list.scm +++ b/scheme/browse-directory-list.scm @@ -126,27 +126,19 @@ (select-list-handle-key-press select-list key)) instance)))) -(define (make-fsobjects-viewer) - (let ((fs-objects #f) - (buffer #f) - (select-list #f) - (working-dir #f)) +(define (make-fsobjects-viewer fs-objects buffer) + (let* ((fs-objects fs-objects) + (buffer buffer) + (working-dir (find-common-parent + (map fs-object-path fs-objects))) + (select-list + (make-file-select-list fs-objects + working-dir + (result-buffer-num-lines buffer)))) + (lambda (message) (cond - ((eq? message 'init) - (lambda (self new-fs-objects new-buffer) - (let ((num-lines (result-buffer-num-lines new-buffer)) - (parent-dir - (find-common-parent - (map fs-object-path new-fs-objects)))) - (set! buffer new-buffer) - (set! fs-objects new-fs-objects) - (set! working-dir parent-dir) - (set! select-list - (make-file-select-list fs-objects parent-dir num-lines)) - self))) - ((eq? message 'init-browser-for-dir) (lambda (self new-dir new-buffer) (with-cwd new-dir