1
0
Fork 0

- [fediverse] added command: 'thread-search-next-undeleted-message'.

This commit is contained in:
cage 2024-11-29 09:47:59 +01:00
parent e070f89b05
commit 15b9e82ba1
5 changed files with 44 additions and 1 deletions

View File

@ -395,6 +395,8 @@
(define-key "n" #'thread-search-next-unread-message *thread-keymap*)
(define-key "C-u" #'thread-search-next-undeleted-message *thread-keymap*)
(define-key "r" #'reply-message *thread-keymap*)
(define-key "right" #'open-next *thread-keymap*)

View File

@ -2497,6 +2497,24 @@ to `timeline' , `folder' and possibly `account-id', older than
(order-by= query :message-index)
(fetch-single query)))
(defun search-next-undeleted-message (timeline
folder
start-status-message-index
&key (account-id nil))
"Search the next undeleted message belonging
to `timeline' , `folder' and possibly `account-id', older than
`start-status-message-index'"
(let* ((query (make-filtered-message-select nil
timeline
folder
account-id
`(:and :> :status.message-index
,start-status-message-index)
`(:and := :status.deletedp
,+db-false+))))
(order-by= query :message-index)
(fetch-single query)))
(defmacro with-add-account-id-to-query ((query query-body) account-id &body body)
`(let ((,query ,query-body))
(when ,account-id

View File

@ -1087,6 +1087,7 @@
:search-next-message-meta
:search-previous-message-meta
:search-next-unread-message
:search-next-undeleted-message
:last-message-index-status
:last-status-id-timeline-folder
:first-status-id-timeline-folder
@ -2495,6 +2496,7 @@
:search-next-message-meta
:search-previous-message-meta
:search-next-unread
:search-next-undeleted
:add-mention
:remove-mention
:goto-message
@ -3048,6 +3050,7 @@
:thread-search-previous-message-meta
:repeat-search
:thread-search-next-unread-message
:thread-search-next-undeleted-message
:thread-open-selected-message
:thread-mark-delete-selected-message
:thread-mark-prevent-delete-selected-message

View File

@ -1062,6 +1062,22 @@ db:renumber-timeline-message-index."
(open-message object))
(ui:info-message (_ "No others unread messages exist")))))))
(defmethod search-next-undeleted ((object thread-window))
(with-accessors ((row-selected-index row-selected-index)
(rows rows)
(timeline-folder timeline-folder)
(timeline-type timeline-type)) object
(a:when-let* ((selected-fields (selected-row-fields object))
(starting-index (db-utils:db-getf selected-fields :message-index)))
(let ((matching-status (db:search-next-undeleted-message timeline-type
timeline-folder
starting-index)))
(if matching-status
(let ((new-message-index (db:row-message-index matching-status)))
(rebuild-lines object new-message-index)
(open-message object))
(ui:info-message (_ "No others undeleted messages exist")))))))
(defmethod add-mention ((object thread-window) mention)
(with-accessors ((mentions mentions)) object
(let ((reversed (reverse mentions)))

View File

@ -343,6 +343,10 @@ Metadata includes:
"Jump to next unread message"
(thread-window:search-next-unread *thread-window*))
(defun thread-search-next-undeleted-message ()
"Jump to next undeleted message"
(thread-window:search-next-undeleted *thread-window*))
(defun repeat-search ()
"Repeat the last search performed"
(push-event (make-instance 'search-next-event