branch: externals/ellama commit 4cb122b5723629146efc90bc62675ad9167d3b14 Author: Sergey Kostyaev <sskosty...@gmail.com> Commit: Sergey Kostyaev <sskosty...@gmail.com>
Add auto-scroll continue logic and out of focus scrolling Fixed the auto-scroll logic in `ellama.el` to ensure it correctly sets and resets `stop-scroll` based on cursor position changes. Added a `redisplay` call at the end of `ellama--scroll` to force a refresh of the window display to correctly hadle auto-scroll of unfocused windows. --- ellama.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ellama.el b/ellama.el index 3540371362..84d179caa2 100644 --- a/ellama.el +++ b/ellama.el @@ -2002,10 +2002,11 @@ failure (with BUFFER current). (let* ((pt (point)) (new-distance-to-end (- (point-max) (point)))) (save-excursion - (when (and (eq (window-buffer (selected-window)) - buffer) - (not (equal distance-to-end new-distance-to-end))) - (setq stop-scroll t)) + (if (and (eq (window-buffer (selected-window)) + buffer) + (not (equal distance-to-end new-distance-to-end))) + (setq stop-scroll t) + (setq stop-scroll nil)) (goto-char start) (delete-region start end) (insert (funcall filter text)) @@ -2237,7 +2238,8 @@ A function for programmatically scrolling the buffer during text generation." (with-selected-window window (when (ellama-chat-buffer-p buf) (goto-char (point-max))) - (recenter -1)))) + (recenter -1) + (redisplay)))) (defun ellama-chat-done (text &optional on-done) "Chat done.