Fix handling of "..", introduce "."
This commit is contained in:
parent
ef642752af
commit
9321a0e8cf
|
@ -146,13 +146,18 @@
|
||||||
(define (make-file-select-list fsobjects parent-dir num-lines num-cols)
|
(define (make-file-select-list fsobjects parent-dir num-lines num-cols)
|
||||||
(let ((parent-dir-len (string-length parent-dir)))
|
(let ((parent-dir-len (string-length parent-dir)))
|
||||||
(make-select-list
|
(make-select-list
|
||||||
(cons (make-unmarked-text-element 'parent-dir #f " ..")
|
(cons (make-unmarked-text-element (file-name->fs-object ".")
|
||||||
|
#t " .")
|
||||||
|
(cons (make-unmarked-text-element
|
||||||
|
(file-name->fs-object "..")
|
||||||
|
#t " ..")
|
||||||
(map (lambda (fs-object)
|
(map (lambda (fs-object)
|
||||||
(make-unmarked-text-element
|
(make-unmarked-text-element
|
||||||
fs-object #t (layout-fsobject parent-dir-len
|
fs-object #t (layout-fsobject parent-dir-len
|
||||||
fs-object num-cols)))
|
fs-object num-cols)))
|
||||||
fsobjects))
|
fsobjects)))
|
||||||
num-lines)))
|
num-lines
|
||||||
|
(if (null? fsobjects) 1 2))))
|
||||||
|
|
||||||
;;; lacks some coolness
|
;;; lacks some coolness
|
||||||
(define (abbrev-path path length)
|
(define (abbrev-path path length)
|
||||||
|
@ -226,12 +231,6 @@
|
||||||
(select-line (make-file-select-line)))
|
(select-line (make-file-select-line)))
|
||||||
|
|
||||||
(define (handle-return-key self selected-entry num-lines)
|
(define (handle-return-key self selected-entry num-lines)
|
||||||
(cond
|
|
||||||
((eq? selected-entry 'parent-dir)
|
|
||||||
(let* ((maybe-parent (file-name-directory working-dir))
|
|
||||||
(parent (if (string=? maybe-parent "") "/" maybe-parent)))
|
|
||||||
(make-browser-for-dir parent buffer)))
|
|
||||||
(else
|
|
||||||
(let ((fi (fs-object-info selected-entry)))
|
(let ((fi (fs-object-info selected-entry)))
|
||||||
(if (and fi (file-info-directory? fi))
|
(if (and fi (file-info-directory? fi))
|
||||||
(with-errno-handler
|
(with-errno-handler
|
||||||
|
@ -242,7 +241,7 @@
|
||||||
self))
|
self))
|
||||||
(make-browser-for-dir (fs-object-complete-path selected-entry)
|
(make-browser-for-dir (fs-object-complete-path selected-entry)
|
||||||
buffer))
|
buffer))
|
||||||
self)))))
|
self)))
|
||||||
|
|
||||||
(define (set-fs-objects! new-fs-objects)
|
(define (set-fs-objects! new-fs-objects)
|
||||||
(set! fs-objects new-fs-objects)
|
(set! fs-objects new-fs-objects)
|
||||||
|
|
Loading…
Reference in New Issue