From 528700907f2c4a838e90296fcb650635c1aec0fc Mon Sep 17 00:00:00 2001 From: cage Date: Sat, 1 May 2021 20:25:15 +0200 Subject: [PATCH] - added a command to show the tour's queue. --- etc/init.lisp | 4 +++- src/package.lisp | 1 + src/ui-goodies.lisp | 16 ++++++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/etc/init.lisp b/etc/init.lisp index 621568c..05edc00 100644 --- a/etc/init.lisp +++ b/etc/init.lisp @@ -349,10 +349,12 @@ (define-key "s" #'gemini-subscribe-gemlog *gemini-message-keymap*) -(define-key "T" #'message-toggle-preformatted-block *gemini-message-keymap*) +(define-key "p" #'message-toggle-preformatted-block *gemini-message-keymap*) (define-key "t" #'next-tour-link *gemini-message-keymap*) +(define-key "T" #'show-tour-links *gemini-message-keymap*) + (define-key "|" #'send-to-pipe *gemini-message-keymap*) diff --git a/src/package.lisp b/src/package.lisp index 4f7520f..62619b7 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -2473,6 +2473,7 @@ :send-message-to-pipe :tour-mode-link :next-tour-link + :show-tour-links :pass-focus-on-left :pass-focus-on-right :pass-focus-on-bottom diff --git a/src/ui-goodies.lisp b/src/ui-goodies.lisp index 5a7d8ee..8be8d87 100644 --- a/src/ui-goodies.lisp +++ b/src/ui-goodies.lisp @@ -1868,16 +1868,15 @@ gemini://gemini.circumlunar.space/docs/companion/subscription.gmi "Enable \"tour mode\". Ask for link indices, each link corresponding to the index will be saved in a special queue that can be opened using `next-tour-link' in a last-in last-out way." - (when-let* ((rows (line-oriented-window:map-rows *open-message-link-window* - #'identity))) + (with-accessors ((links open-message-link-window::links)) *open-message-link-window* (flet ((on-input-complete (indices) (when (string-not-empty-p indices) (let ((indices-list (mapcar #'num:safe-parse-number (split-words indices)))) (loop for index in indices-list when index do - (if (<= 0 index (length rows)) - (push (elt rows index) + (if (<= 0 index (length links)) + (push (elt links index) tour) (notify (format nil (_ "Index ~a out of range") index) :as-error t))) @@ -1891,6 +1890,11 @@ gemini://gemini.circumlunar.space/docs/companion/subscription.gmi (link (first queue))) (if (null queue) (error-message (_ "Tour completed")) - (let ((url (line-oriented-window:normal-text link))) + (let ((url (gemini-parser:target link))) (setf tour (reverse (rest queue))) - (open-message-link-window:open-message-link url nil)))))) + (open-message-link-window:open-message-link url nil))))) + + (defun show-tour-links () + "Show a link window with all the links in the tour queue" + (open-message-link-window:init-gemini-links tour) + (focus-to-open-message-link-window)))