mirror of https://codeberg.org/cage/tinmop/
- fixed adjusting strategy functions when drawing gemini text.
This commit is contained in:
parent
c924e8f636
commit
9568b88e8d
|
@ -229,22 +229,18 @@
|
||||||
(when (rows window)
|
(when (rows window)
|
||||||
(select-first-row window)))
|
(select-first-row window)))
|
||||||
|
|
||||||
|
(defun adjust-rows-noop (window)
|
||||||
|
window)
|
||||||
|
|
||||||
(defun adjust-rows-select-last (window)
|
(defun adjust-rows-select-last (window)
|
||||||
(with-accessors ((rows rows)) window
|
(with-accessors ((rows rows)) window
|
||||||
(when rows
|
(when rows
|
||||||
(let ((height (win-height-no-border window)))
|
(let ((height (win-height-no-border window)))
|
||||||
(when (not (< (rows-length window) height))
|
(when (>= (rows-length window) height)
|
||||||
(select-row window (- (rows-length window)
|
(select-row window (- (rows-length window)
|
||||||
height))))))
|
height))))))
|
||||||
window)
|
window)
|
||||||
|
|
||||||
(defmethod adjust-selected-rows ((object row-oriented-widget) (strategy function))
|
|
||||||
(with-accessors ((row-selected-index row-selected-index)) object
|
|
||||||
(when (< row-selected-index
|
|
||||||
(rows-length object))
|
|
||||||
(funcall strategy object)))
|
|
||||||
object)
|
|
||||||
|
|
||||||
(defmethod selected-row ((object row-oriented-widget))
|
(defmethod selected-row ((object row-oriented-widget))
|
||||||
"Return the current selected row"
|
"Return the current selected row"
|
||||||
(with-accessors ((rows rows)
|
(with-accessors ((rows rows)
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
:initarg :metadata
|
:initarg :metadata
|
||||||
:accessor metadata)
|
:accessor metadata)
|
||||||
(adjust-rows-strategy
|
(adjust-rows-strategy
|
||||||
:initform #'adjust-rows-select-first
|
:initform #'adjust-rows-noop
|
||||||
:initarg :adjust-rows-strategy
|
:initarg :adjust-rows-strategy
|
||||||
:accessor adjust-rows-strategy)
|
:accessor adjust-rows-strategy)
|
||||||
(text-starting-column
|
(text-starting-column
|
||||||
|
|
|
@ -1935,6 +1935,7 @@
|
||||||
:unselect-all
|
:unselect-all
|
||||||
:select-row
|
:select-row
|
||||||
:select-first-row
|
:select-first-row
|
||||||
|
:adjust-rows-noop
|
||||||
:adjust-rows-select-first
|
:adjust-rows-select-first
|
||||||
:adjust-rows-select-last
|
:adjust-rows-select-last
|
||||||
:adjust-selected-rows
|
:adjust-selected-rows
|
||||||
|
@ -2074,7 +2075,6 @@
|
||||||
:row-get-original-object
|
:row-get-original-object
|
||||||
:viewport-width
|
:viewport-width
|
||||||
:draw-downloading-animation
|
:draw-downloading-animation
|
||||||
:adjust-selected-rows
|
|
||||||
:visible-rows
|
:visible-rows
|
||||||
:row-vertical-space-p
|
:row-vertical-space-p
|
||||||
:row-preformatted-p
|
:row-preformatted-p
|
||||||
|
|
|
@ -1224,12 +1224,13 @@
|
||||||
(progn
|
(progn
|
||||||
(line-oriented-window:append-new-rows win new-rows)
|
(line-oriented-window:append-new-rows win new-rows)
|
||||||
(gemini-viewer:append-metadata-link window-metadata links)
|
(gemini-viewer:append-metadata-link window-metadata links)
|
||||||
(gemini-viewer:append-metadata-source window-metadata source))
|
(gemini-viewer:append-metadata-source window-metadata source)
|
||||||
|
(funcall (message-window:adjust-rows-strategy win) win))
|
||||||
|
|
||||||
(progn
|
(progn
|
||||||
(setf (gemini-viewer:gemini-metadata-source-file window-metadata) source)
|
(setf (gemini-viewer:gemini-metadata-source-file window-metadata) source)
|
||||||
(setf (gemini-viewer:gemini-metadata-links window-metadata) links)
|
(setf (gemini-viewer:gemini-metadata-links window-metadata) links)
|
||||||
(funcall (message-window:adjust-rows-strategy win)
|
(funcall (message-window:adjust-rows-strategy win) win)
|
||||||
win)
|
|
||||||
(line-oriented-window:update-all-rows win new-rows)))))))
|
(line-oriented-window:update-all-rows win new-rows)))))))
|
||||||
|
|
||||||
(defmethod process-event ((object gemini-got-line-event))
|
(defmethod process-event ((object gemini-got-line-event))
|
||||||
|
@ -1251,14 +1252,9 @@
|
||||||
(not (skip-rendering-p object))
|
(not (skip-rendering-p object))
|
||||||
(message-window:display-gemini-text-p win))
|
(message-window:display-gemini-text-p win))
|
||||||
(refresh-gemini-message-window links source ir-line append-text)
|
(refresh-gemini-message-window links source ir-line append-text)
|
||||||
(multiple-value-bind (x start length)
|
|
||||||
(message-window:visible-rows win)
|
|
||||||
(declare (ignore x))
|
|
||||||
(if (or (not append-text)
|
|
||||||
(< (+ start length)
|
|
||||||
(windows:win-height-no-border win)))
|
|
||||||
(windows:draw win)
|
(windows:draw win)
|
||||||
(message-window:draw-downloading-animation win))))))))
|
(when append-text
|
||||||
|
(message-window:draw-downloading-animation win)))))))
|
||||||
|
|
||||||
(defclass gemini-abort-downloading-event (program-event) ())
|
(defclass gemini-abort-downloading-event (program-event) ())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue