diff --git a/src/line-oriented-window.lisp b/src/line-oriented-window.lisp index 100c556..6436dcf 100644 --- a/src/line-oriented-window.lisp +++ b/src/line-oriented-window.lisp @@ -229,22 +229,18 @@ (when (rows window) (select-first-row window))) +(defun adjust-rows-noop (window) + window) + (defun adjust-rows-select-last (window) (with-accessors ((rows rows)) window (when rows (let ((height (win-height-no-border window))) - (when (not (< (rows-length window) height)) + (when (>= (rows-length window) height) (select-row window (- (rows-length window) height)))))) 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)) "Return the current selected row" (with-accessors ((rows rows) diff --git a/src/message-window.lisp b/src/message-window.lisp index b3fd598..607e4c3 100644 --- a/src/message-window.lisp +++ b/src/message-window.lisp @@ -33,7 +33,7 @@ :initarg :metadata :accessor metadata) (adjust-rows-strategy - :initform #'adjust-rows-select-first + :initform #'adjust-rows-noop :initarg :adjust-rows-strategy :accessor adjust-rows-strategy) (text-starting-column diff --git a/src/package.lisp b/src/package.lisp index e3ede40..fb0d167 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -1935,6 +1935,7 @@ :unselect-all :select-row :select-first-row + :adjust-rows-noop :adjust-rows-select-first :adjust-rows-select-last :adjust-selected-rows @@ -2074,7 +2075,6 @@ :row-get-original-object :viewport-width :draw-downloading-animation - :adjust-selected-rows :visible-rows :row-vertical-space-p :row-preformatted-p diff --git a/src/program-events.lisp b/src/program-events.lisp index dd9dec5..3cd2211 100644 --- a/src/program-events.lisp +++ b/src/program-events.lisp @@ -1224,12 +1224,13 @@ (progn (line-oriented-window:append-new-rows win new-rows) (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 (setf (gemini-viewer:gemini-metadata-source-file window-metadata) source) (setf (gemini-viewer:gemini-metadata-links window-metadata) links) - (funcall (message-window:adjust-rows-strategy win) - win) + (funcall (message-window:adjust-rows-strategy win) win) (line-oriented-window:update-all-rows win new-rows))))))) (defmethod process-event ((object gemini-got-line-event)) @@ -1251,14 +1252,9 @@ (not (skip-rendering-p object)) (message-window:display-gemini-text-p win)) (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) - (message-window:draw-downloading-animation win)))))))) + (windows:draw win) + (when append-text + (message-window:draw-downloading-animation win))))))) (defclass gemini-abort-downloading-event (program-event) ())