branch: externals/ellama commit d9456fdc4b6f467cc5b60d9fa081fefcdc39acba Merge: c1b51834c9 682686da7c Author: Sergey Kostyaev <s-kosty...@users.noreply.github.com> Commit: GitHub <nore...@github.com>
Merge pull request #243 from s-kostyaev/improve-auto-scroll Improve auto scroll --- NEWS.org | 5 +++++ ellama.el | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/NEWS.org b/NEWS.org index c122895e2c..7767d188fd 100644 --- a/NEWS.org +++ b/NEWS.org @@ -1,3 +1,8 @@ +* Version 1.4.2 +- 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 handle auto-scroll of unfocused windows. * Version 1.4.1 - Fixed a bug where users couldn't move the cursor during generation when auto-scroll was enabled. diff --git a/ellama.el b/ellama.el index 3540371362..a453ace783 100644 --- a/ellama.el +++ b/ellama.el @@ -6,7 +6,7 @@ ;; URL: http://github.com/s-kostyaev/ellama ;; Keywords: help local tools ;; Package-Requires: ((emacs "28.1") (llm "0.22.0") (plz "0.8") (transient "0.7") (compat "29.1")) -;; Version: 1.4.1 +;; Version: 1.4.2 ;; SPDX-License-Identifier: GPL-3.0-or-later ;; Created: 8th Oct 2023 @@ -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.