From 318683be00b83126619c688502b4ab99b5177642 Mon Sep 17 00:00:00 2001 From: Sergey Kostyaev Date: Tue, 9 Jul 2024 02:40:48 +0700 Subject: [PATCH] Fix autoscrolling for editing commands --- ellama.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ellama.el b/ellama.el index 2165ea1..c129589 100644 --- a/ellama.el +++ b/ellama.el @@ -1209,6 +1209,11 @@ If EPHEMERAL non nil new session will not be associated with any file." prompt) prompt)) +(defun ellama-chat-buffer-p (buffer) + "Return non-nil if BUFFER is an ellama chat buffer." + (with-current-buffer buffer + (not (not ellama--current-session)))) + (defun ellama-stream (prompt &rest args) "Query ellama for PROMPT. ARGS contains keys for fine control. @@ -1283,9 +1288,10 @@ failure (with BUFFER current). (goto-char pt)) (when-let ((ellama-auto-scroll) (window (get-buffer-window buffer))) - (with-selected-window window - (goto-char (point-max)) - (recenter -1))) + (when (ellama-chat-buffer-p buffer) + (with-selected-window window + (goto-char (point-max)) + (recenter -1)))) (undo-amalgamate-change-group ellama--change-group))))) (setq ellama--change-group (prepare-change-group)) (activate-change-group ellama--change-group)