mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-23 09:07:37 +01:00
- [gemini] added searching or jumping to first or last item in a TOC window.
This commit is contained in:
parent
808dad006e
commit
1acad1fad9
@ -440,6 +440,14 @@
|
|||||||
|
|
||||||
(define-key "p" #'gemini-toc-scroll-up-page *gemini-toc-keymap*)
|
(define-key "p" #'gemini-toc-scroll-up-page *gemini-toc-keymap*)
|
||||||
|
|
||||||
|
(define-key "home" #'gemini-toc-scroll-begin *gemini-toc-keymap*)
|
||||||
|
|
||||||
|
(define-key "end" #'gemini-toc-scroll-end *gemini-toc-keymap*)
|
||||||
|
|
||||||
|
(define-key "/" #'gemini-toc-search *gemini-toc-keymap*)
|
||||||
|
|
||||||
|
(define-key "N" #'repeat-search *gemini-toc-keymap*)
|
||||||
|
|
||||||
;; gemini stream window keymap
|
;; gemini stream window keymap
|
||||||
|
|
||||||
(define-key "a" #'gemini-abort-download *gemini-downloads-keymap*)
|
(define-key "a" #'gemini-abort-download *gemini-downloads-keymap*)
|
||||||
|
@ -1527,6 +1527,9 @@
|
|||||||
:gemlog-refresh-all-event
|
:gemlog-refresh-all-event
|
||||||
:gemini-toc-jump-to-section
|
:gemini-toc-jump-to-section
|
||||||
:gemini-toc-open
|
:gemini-toc-open
|
||||||
|
:gemini-toc-scroll-begin
|
||||||
|
:gemini-toc-scroll-end
|
||||||
|
:gemini-toc-search
|
||||||
:get-chat-messages-event
|
:get-chat-messages-event
|
||||||
:get-chats-event
|
:get-chats-event
|
||||||
:chat-show-event
|
:chat-show-event
|
||||||
@ -1535,6 +1538,7 @@
|
|||||||
:chat-change-label-event
|
:chat-change-label-event
|
||||||
:chat-create-event
|
:chat-create-event
|
||||||
:search-link-event
|
:search-link-event
|
||||||
|
:search-toc-event
|
||||||
:help-apropos-event
|
:help-apropos-event
|
||||||
:redraw-window-event
|
:redraw-window-event
|
||||||
:send-to-pipe-event
|
:send-to-pipe-event
|
||||||
|
@ -1581,6 +1581,22 @@
|
|||||||
(regex regex)) object
|
(regex regex)) object
|
||||||
(line-oriented-window:search-row window regex)))
|
(line-oriented-window:search-row window regex)))
|
||||||
|
|
||||||
|
(defclass search-toc-event (search-event)
|
||||||
|
((window
|
||||||
|
:initform nil
|
||||||
|
:initarg :window
|
||||||
|
:accessor window)
|
||||||
|
(regex
|
||||||
|
:initform nil
|
||||||
|
:initarg :regex
|
||||||
|
:accessor regex)))
|
||||||
|
|
||||||
|
(defmethod process-event ((object search-toc-event))
|
||||||
|
(with-accessors ((window window)
|
||||||
|
(regex regex)) object
|
||||||
|
(line-oriented-window:search-row window regex)
|
||||||
|
(ui:gemini-toc-jump-to-entry)))
|
||||||
|
|
||||||
(defclass help-apropos-event (program-event)
|
(defclass help-apropos-event (program-event)
|
||||||
((regex
|
((regex
|
||||||
:initform nil
|
:initform nil
|
||||||
|
@ -1335,6 +1335,7 @@ This makes sense only for gemini file stream, if not this command performs the s
|
|||||||
(defun line-oriented-window-scroll-begin (window)
|
(defun line-oriented-window-scroll-begin (window)
|
||||||
(when (and window
|
(when (and window
|
||||||
(not (line-oriented-window:rows-empty-p window)))
|
(not (line-oriented-window:rows-empty-p window)))
|
||||||
|
(line-oriented-window:unselect-all window)
|
||||||
(line-oriented-window:select-row window 0)
|
(line-oriented-window:select-row window 0)
|
||||||
(windows:win-clear window)
|
(windows:win-clear window)
|
||||||
(windows:draw window)))
|
(windows:draw window)))
|
||||||
@ -1342,6 +1343,7 @@ This makes sense only for gemini file stream, if not this command performs the s
|
|||||||
(defun line-oriented-window-scroll-end (window)
|
(defun line-oriented-window-scroll-end (window)
|
||||||
(when (and window
|
(when (and window
|
||||||
(not (line-oriented-window:rows-empty-p window)))
|
(not (line-oriented-window:rows-empty-p window)))
|
||||||
|
(line-oriented-window:unselect-all window)
|
||||||
(line-oriented-window:select-row window (1- (line-oriented-window:rows-length window)))
|
(line-oriented-window:select-row window (1- (line-oriented-window:rows-length window)))
|
||||||
(windows:win-clear window)
|
(windows:win-clear window)
|
||||||
(windows:draw window)))
|
(windows:draw window)))
|
||||||
@ -2231,6 +2233,26 @@ gemini page the program is rendering."
|
|||||||
(defun gemini-toc-scroll-up-page ()
|
(defun gemini-toc-scroll-up-page ()
|
||||||
(message-window:scroll-up *message-window*))
|
(message-window:scroll-up *message-window*))
|
||||||
|
|
||||||
|
(defun gemini-toc-scroll-begin ()
|
||||||
|
(line-oriented-window-scroll-begin *gemini-toc-window*)
|
||||||
|
(gemini-toc-jump-to-entry))
|
||||||
|
|
||||||
|
(defun gemini-toc-scroll-end ()
|
||||||
|
(line-oriented-window-scroll-end *gemini-toc-window*)
|
||||||
|
(gemini-toc-jump-to-entry))
|
||||||
|
|
||||||
|
(defun gemini-toc-search ()
|
||||||
|
"Search toc with a text matching a regular expression"
|
||||||
|
(flet ((on-input-complete (regex)
|
||||||
|
(when-let* ((window (main-window:focused-window *main-window*)))
|
||||||
|
(let ((event (make-instance 'search-toc-event
|
||||||
|
:window window
|
||||||
|
:regex regex)))
|
||||||
|
(push-event event)))))
|
||||||
|
(ask-string-input #'on-input-complete
|
||||||
|
:prompt (_ "Search key: ")
|
||||||
|
:complete-fn #'complete:complete-always-empty)))
|
||||||
|
|
||||||
(defun ask-input-on-tofu-error (condition fn)
|
(defun ask-input-on-tofu-error (condition fn)
|
||||||
(let ((host (gemini-client:host condition)))
|
(let ((host (gemini-client:host condition)))
|
||||||
(flet ((on-input-complete (maybe-accepted)
|
(flet ((on-input-complete (maybe-accepted)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user