1
0
Fork 0

- fixed thread-window:resync-rows-db, was not redrawing the window if no message was presents.

This commit is contained in:
cage 2021-09-11 21:54:52 +02:00
parent 49f9232288
commit c12f444111
1 changed files with 36 additions and 15 deletions

View File

@ -756,29 +756,43 @@ db:renumber-timeline-message-index."
(select-row object new-index))) (select-row object new-index)))
(draw object))))) (draw object)))))
(defun message-index-valid-p (timeline-type timeline-folder message-index)
(db:message-from-timeline-folder-message-index timeline-type
timeline-folder
message-index))
(defun update-thread-window (window message-index)
(multiple-value-bind (tree pos)
(fit-timeline-to-window window message-index)
(build-lines window tree pos)))
(defmethod goto-message ((object thread-window) (message-index number) &key (redraw t)) (defmethod goto-message ((object thread-window) (message-index number) &key (redraw t))
(with-accessors ((timeline-folder timeline-folder) (with-accessors ((timeline-folder timeline-folder)
(timeline-type timeline-type)) object (timeline-type timeline-type)) object
(let ((message (db:message-from-timeline-folder-message-index timeline-type (let ((message-index-valid-p (message-index-valid-p timeline-type
timeline-folder timeline-folder
message-index))) message-index)))
(if message (if message-index-valid-p
(multiple-value-bind (tree pos) (progn
(fit-timeline-to-window object message-index) (update-thread-window object message-index)
(build-lines object tree pos)
(when redraw (when redraw
(draw object))) (draw object)))
(ui:info-message (format nil (ui:info-message (format nil
(_ "No message with index ~a exists.") (_ "No message with index ~a exists.")
message-index)))))) message-index))))))
(defun message-tuple-id->message-index (timeline-type timeline-folder status-id)
(when-let* ((message (db::message-from-timeline-folder-id timeline-type
timeline-folder
status-id)))
(db:row-message-index message)))
(defmethod goto-message ((object thread-window) (message-index string) &key (redraw t)) (defmethod goto-message ((object thread-window) (message-index string) &key (redraw t))
(with-accessors ((timeline-folder timeline-folder) (with-accessors ((timeline-folder timeline-folder)
(timeline-type timeline-type)) object (timeline-type timeline-type)) object
(when-let* ((message (db::message-from-timeline-folder-id timeline-type (when-let* ((index (message-tuple-id->message-index timeline-type
timeline-folder timeline-folder
message-index)) message-index)))
(index (db:row-message-index message)))
(goto-message object index :redraw redraw)))) (goto-message object index :redraw redraw))))
(defmethod goto-first-message ((object thread-window)) (defmethod goto-first-message ((object thread-window))
@ -800,17 +814,24 @@ db:renumber-timeline-message-index."
(suggested-message-index nil) (suggested-message-index nil)
(suggested-status-id nil)) (suggested-status-id nil))
(with-accessors ((row-selected-index row-selected-index) (with-accessors ((row-selected-index row-selected-index)
(rows rows)) object (rows rows)
(timeline-folder timeline-folder)
(timeline-type timeline-type)) object
(when-window-shown (object) (when-window-shown (object)
(cond (cond
(suggested-status-id (suggested-status-id
(goto-message object suggested-status-id :redraw redraw)) (let ((message-index (message-tuple-id->message-index timeline-type
timeline-folder
suggested-status-id)))
(update-thread-window object message-index)))
(suggested-message-index (suggested-message-index
(goto-message object suggested-message-index :redraw redraw)) (update-thread-window object suggested-message-index))
(t (t
(let* ((selected-row (selected-row object)) (let* ((selected-row (selected-row object))
(message-index (db:row-message-index (fields selected-row)))) (message-index (db:row-message-index (fields selected-row))))
(goto-message object message-index :redraw redraw)))))) (update-thread-window object message-index))))
(when redraw
(draw object))))
object) object)
(defun reblogged-data (reblogger-status) (defun reblogged-data (reblogger-status)