mirror of
https://codeberg.org/cage/tinmop/
synced 2025-03-11 11:10:43 +01:00
- 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:
parent
00cfe36e90
commit
0da5e6b3ad
@ -616,12 +616,16 @@
|
|||||||
|
|
||||||
(define-key "N" #'repeat-search *filesystem-explorer-keymap*)
|
(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 "up" #'file-explorer-go-up *filesystem-explorer-keymap*)
|
||||||
|
|
||||||
(define-key "down" #'file-explorer-go-down *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
|
;;;; hooks
|
||||||
|
|
||||||
;; this module will install an hook to rewrite urls; By default it
|
;; this module will install an hook to rewrite urls; By default it
|
||||||
|
@ -46,35 +46,51 @@
|
|||||||
(filesystem-expand-function
|
(filesystem-expand-function
|
||||||
:initform #'expand-local-filesystem-node
|
:initform #'expand-local-filesystem-node
|
||||||
:accessor filesystem-expand-function
|
: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
|
(filesystem-rename-function
|
||||||
:initform #'rename-local-filesystem-node
|
:initform #'rename-local-filesystem-node
|
||||||
:accessor filesystem-rename-function
|
: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
|
(filesystem-delete-function
|
||||||
:initform #'delete-local-filesystem-node
|
:initform #'delete-local-filesystem-node
|
||||||
:accessor filesystem-delete-function
|
:accessor filesystem-delete-function
|
||||||
:type function)
|
:type function
|
||||||
|
:documentation "A function with the node as parameter.")
|
||||||
(filesystem-create-function
|
(filesystem-create-function
|
||||||
:initform #'create-local-filesystem-node
|
:initform #'create-local-filesystem-node
|
||||||
:accessor filesystem-create-function
|
: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
|
(filesystem-download-function
|
||||||
:initform #'download-local-filesystem-node
|
:initform #'download-local-filesystem-node
|
||||||
:accessor filesystem-download-function
|
: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
|
(filesystem-upload-function
|
||||||
:initform #'upload-local-filesystem-node
|
:initform #'upload-local-filesystem-node
|
||||||
:accessor filesystem-upload-function
|
: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
|
(filesystem-query-path-function
|
||||||
:initform #'query-local-filesystem-path
|
:initform #'query-local-filesystem-path
|
||||||
:accessor filesystem-query-path-function
|
:accessor filesystem-query-path-function
|
||||||
:type function
|
:type function
|
||||||
:documentation "function with two parameter the path and a feature to query
|
:documentation "function with two parameter the path and a feature
|
||||||
Valid feature vaule are :size.
|
to query Valid feature values are :size. Returns nil if Returns nil
|
||||||
Returns nil if Returns nil if the path does not point to an actual file."))
|
if the path does not point to an actual file."))
|
||||||
(:documentation "A window that shows and allow interacting with a hierarchical filesystem"))
|
(:documentation "A window that shows and allow interacting with a
|
||||||
|
hierarchical filesystem"))
|
||||||
|
|
||||||
(defmethod refresh-config :after ((object filesystem-tree-window))
|
(defmethod refresh-config :after ((object filesystem-tree-window))
|
||||||
(with-croatoan-window (croatoan-window object)
|
(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)))
|
(fgcolor window)))
|
||||||
|
|
||||||
(defun query-local-filesystem-path (path what)
|
(defun query-local-filesystem-path (path what)
|
||||||
(case what
|
(ecase what
|
||||||
(:size
|
(:size
|
||||||
(and (fs:file-exists-p path)
|
(and (fs:file-exists-p path)
|
||||||
(fs:file-size path)))
|
(fs:file-size path)))))
|
||||||
(otherwise
|
|
||||||
nil)))
|
|
||||||
|
|
||||||
(defun expand-local-filesystem-node (matching-node)
|
(defun expand-local-filesystem-node (matching-node)
|
||||||
(let ((path (tree-path (data matching-node))))
|
(let ((path (tree-path (data matching-node))))
|
||||||
|
@ -2808,7 +2808,9 @@
|
|||||||
:file-explorer-search
|
:file-explorer-search
|
||||||
:file-explorer-mark-entry
|
:file-explorer-mark-entry
|
||||||
:file-explorer-delete-tree
|
:file-explorer-delete-tree
|
||||||
:file-explorer-delete-marked))
|
:file-explorer-delete-marked
|
||||||
|
:file-explorer-scroll-begin
|
||||||
|
:file-explorer-scroll-end))
|
||||||
|
|
||||||
(defpackage :scheduled-events
|
(defpackage :scheduled-events
|
||||||
(:use
|
(:use
|
||||||
|
@ -2571,7 +2571,7 @@ printed, on the main window."
|
|||||||
(format nil (_ "Delete ~a? ") path)))))
|
(format nil (_ "Delete ~a? ") path)))))
|
||||||
|
|
||||||
(defun file-explorer-delete-marked ()
|
(defun file-explorer-delete-marked ()
|
||||||
(when-let* ((win *filesystem-explorer-window*))
|
(when-let* ((win *filesystem-explorer-window*))
|
||||||
(flet ((on-input-complete (maybe-accepted)
|
(flet ((on-input-complete (maybe-accepted)
|
||||||
(with-valid-yes-at-prompt (maybe-accepted y-pressed-p)
|
(with-valid-yes-at-prompt (maybe-accepted y-pressed-p)
|
||||||
(when y-pressed-p
|
(when y-pressed-p
|
||||||
@ -2586,3 +2586,17 @@ printed, on the main window."
|
|||||||
:redraw t))))))
|
:redraw t))))))
|
||||||
(ask-string-input #'on-input-complete
|
(ask-string-input #'on-input-complete
|
||||||
:prompt (_ "Delete marked items? ")))))
|
: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))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user