From 5e230407c6a3173ded3dc39242db648be759feb5 Mon Sep 17 00:00:00 2001 From: cage Date: Mon, 26 Jul 2021 19:03:10 +0200 Subject: [PATCH] - added adjust-strategy-last to show text in message-window; - removed call to 'adjust-selected-rows' when redrawing message-window; - fixed 'adjust-selected-rows', wa never actually called. --- src/line-oriented-window.lisp | 15 ++++++++++++--- src/message-window.lisp | 16 +++++++--------- src/package.lisp | 3 +++ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/line-oriented-window.lisp b/src/line-oriented-window.lisp index 09dc8e9..6a81a23 100644 --- a/src/line-oriented-window.lisp +++ b/src/line-oriented-window.lisp @@ -226,11 +226,20 @@ (defun adjust-rows-select-first (window) (select-first-row 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)) + (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 (< (rows-length object) - row-selected-index) - (funcall strategy object))) + (when (< row-selected-index + (rows-length object)) + (funcall strategy object))) object) (defmethod selected-row ((object row-oriented-widget)) diff --git a/src/message-window.lisp b/src/message-window.lisp index cf8b064..1c3af12 100644 --- a/src/message-window.lisp +++ b/src/message-window.lisp @@ -186,15 +186,13 @@ (print-text window line-position-mark mark-x mark-y)))) (defmethod draw ((object message-window)) - (with-accessors ((adjust-rows-strategy adjust-rows-strategy)) object - (when-window-shown (object) - (adjust-selected-rows object adjust-rows-strategy) - (win-clear object :redraw nil) - (win-box object) - (draw-text object) - (when (not (line-oriented-window:rows-empty-p object)) - (draw-buffer-line-mark object)) - (call-next-method)))) + (when-window-shown (object) + (win-clear object :redraw nil) + (win-box object) + (draw-text object) + (when (not (line-oriented-window:rows-empty-p object)) + (draw-buffer-line-mark object)) + (call-next-method))) (let ((index 0) (frames -1) diff --git a/src/package.lisp b/src/package.lisp index ad963bb..c0bf8cb 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -1863,6 +1863,7 @@ :select-row :select-first-row :adjust-rows-select-first + :adjust-rows-select-last :adjust-selected-rows :selected-row :ignore-selecting-action @@ -1989,6 +1990,7 @@ (:export :message-window :metadata + :adjust-rows-strategy :gemini-window-p* :gemini-window-p :display-gemini-text-p @@ -1996,6 +1998,7 @@ :row-get-original-object :viewport-width :draw-downloading-animation + :adjust-selected-rows :visible-rows :row-vertical-space-p :row-preformatted-p