1
0
Fork 0

- added command file-explorer-scroll-begin;

- added command file-explorer-scroll-end;
- modified 'query-local-filesystem-path' signals an error if the query type is unknown.
This commit is contained in:
cage 2022-01-06 11:39:29 +01:00
parent 00cfe36e90
commit 0da5e6b3ad
4 changed files with 51 additions and 17 deletions

View File

@ -616,12 +616,16 @@
(define-key "N" #'repeat-search *filesystem-explorer-keymap*)
(define-key "m" #'file-explorer-mark-entry *filesystem-explorer-keymap*)
(define-key "m" #'file-explorer-mark-entry *filesystem-explorer-keymap*)
(define-key "up" #'file-explorer-go-up *filesystem-explorer-keymap*)
(define-key "down" #'file-explorer-go-down *filesystem-explorer-keymap*)
(define-key "home" #'file-explorer-scroll-begin *filesystem-explorer-keymap*)
(define-key "end" #'file-explorer-scroll-end *filesystem-explorer-keymap*)
;;;; hooks
;; this module will install an hook to rewrite urls; By default it

View File

@ -46,35 +46,51 @@
(filesystem-expand-function
:initform #'expand-local-filesystem-node
:accessor filesystem-expand-function
:type function)
:type function
:documentation "A function with the node as parameter. Will modify
the argument appending its children")
(filesystem-rename-function
:initform #'rename-local-filesystem-node
:accessor filesystem-rename-function
:type function)
:type function
:documentation "A function with two parameters: a node and the new
name for the path of the matching node")
(filesystem-delete-function
:initform #'delete-local-filesystem-node
:accessor filesystem-delete-function
:type function)
:type function
:documentation "A function with the node as parameter.")
(filesystem-create-function
:initform #'create-local-filesystem-node
:accessor filesystem-create-function
:type function)
:type function
:documentation "A function with two parameter the path to create
and a boolean thah values true if a directory must be created")
(filesystem-download-function
:initform #'download-local-filesystem-node
:accessor filesystem-download-function
:type function)
:type function
:documentation "A function to download a remote file, parameters
are - node (remote file) - destination-file (local file, note that
this should be an optional parameter with default
: (fs:temporary-file).")
(filesystem-upload-function
:initform #'upload-local-filesystem-node
:accessor filesystem-upload-function
:type function)
:type function
:documentation "A function to upload a local file, parameters:
- source-path (local path)
- matching-node (remote directory).")
(filesystem-query-path-function
:initform #'query-local-filesystem-path
:accessor filesystem-query-path-function
:type function
:documentation "function with two parameter the path and a feature to query
Valid feature vaule are :size.
Returns nil if Returns nil if the path does not point to an actual file."))
(:documentation "A window that shows and allow interacting with a hierarchical filesystem"))
:documentation "function with two parameter the path and a feature
to query Valid feature values are :size. Returns nil if Returns nil
if the path does not point to an actual file."))
(:documentation "A window that shows and allow interacting with a
hierarchical filesystem"))
(defmethod refresh-config :after ((object filesystem-tree-window))
(with-croatoan-window (croatoan-window object)
@ -115,12 +131,10 @@ Returns nil if Returns nil if the path does not point to an actual file."))
(fgcolor window)))
(defun query-local-filesystem-path (path what)
(case what
(ecase what
(:size
(and (fs:file-exists-p path)
(fs:file-size path)))
(otherwise
nil)))
(fs:file-size path)))))
(defun expand-local-filesystem-node (matching-node)
(let ((path (tree-path (data matching-node))))

View File

@ -2808,7 +2808,9 @@
:file-explorer-search
:file-explorer-mark-entry
:file-explorer-delete-tree
:file-explorer-delete-marked))
:file-explorer-delete-marked
:file-explorer-scroll-begin
:file-explorer-scroll-end))
(defpackage :scheduled-events
(:use

View File

@ -2571,7 +2571,7 @@ printed, on the main window."
(format nil (_ "Delete ~a? ") path)))))
(defun file-explorer-delete-marked ()
(when-let* ((win *filesystem-explorer-window*))
(when-let* ((win *filesystem-explorer-window*))
(flet ((on-input-complete (maybe-accepted)
(with-valid-yes-at-prompt (maybe-accepted y-pressed-p)
(when y-pressed-p
@ -2586,3 +2586,17 @@ printed, on the main window."
:redraw t))))))
(ask-string-input #'on-input-complete
:prompt (_ "Delete marked items? ")))))
(defun file-explorer-scroll-begin ()
(when-let* ((win *filesystem-explorer-window*))
(when (not (line-oriented-window:rows-empty-p win))
(line-oriented-window:select-row win 0)
(windows:win-clear win)
(windows:draw win))))
(defun file-explorer-scroll-end ()
(when-let* ((win *filesystem-explorer-window*))
(when (not (line-oriented-window:rows-empty-p win))
(line-oriented-window:select-row win (1- (line-oriented-window:rows-length win)))
(windows:win-clear win)
(windows:draw win))))