1
0
Fork 0

Compare commits

...

2 Commits

Author SHA1 Message Date
cage a118ce13de - fixed command: 'thread-go-to-parent-post'. 2024-04-04 17:14:25 +02:00
cage 77249e97e3 -added new command: 'thread-go-to-parent-post'. 2024-04-04 15:45:47 +02:00
3 changed files with 24 additions and 2 deletions

View File

@ -270,6 +270,8 @@
(status-id (db:row-message-status-id selected-row)))
(ui:info-message (format nil "ID: ~a" status-id))))
(define-key "^" #'thread-go-to-parent-post *thread-keymap*)
(define-key "/ b" #'thread-search-next-message-body *thread-keymap*)
(define-key "/ m" #'thread-search-next-message-meta *thread-keymap*)

View File

@ -3203,7 +3203,8 @@
:delete-notifications
:show-announcements
:show-parent-post
:switch-fediverse-account))
:switch-fediverse-account
:thread-go-to-parent-post))
(defpackage :scheduled-events
(:use

View File

@ -265,7 +265,7 @@
"Jump to message"
(flet ((on-input-complete (index)
(when-let* ((index-as-number (num:safe-parse-number index))
(event (make-instance 'thread-goto-message
(event (make-instance 'thread-goto-message
:payload index-as-number)))
(push-event event))))
(ask-string-input #'on-input-complete :prompt (_ "Jump to message: "))))
@ -3635,3 +3635,22 @@ gemini client certificates!)."
(ask-string-input #'on-input-complete
:prompt (_ "Switch to account: ")
:complete-fn #'complete:fediverse-account)))
(defun thread-go-to-parent-post ()
"Select and move to the parent of the current selected post"
(when-let* ((timeline (thread-window:timeline-type *thread-window*))
(folder (thread-window:timeline-folder *thread-window*))
(selected-row (line-oriented-window:selected-row-fields *thread-window*))
(status-id (actual-author-message-id selected-row))
;; NB: db:get-parent-status-row does not take into account the folder or timeline...
(generic-parent-row (db:get-parent-status-row status-id))
(generic-parent-id (db:row-message-status-id generic-parent-row))
;; ...so we need to call
;; db::find-status-id-folder-timeline to get the actual
;; row for the folder and timeline the user is reading...
(status-parent-row (db::find-status-id-folder-timeline generic-parent-id folder timeline))
;; ...and get the correct message index
(index (db:row-message-index status-parent-row))
(event (make-instance 'thread-goto-message
:payload index)))
(push-event event)))