Skip to content

Commit

Permalink
Merge pull request #137 from s-kostyaev/fix-autoscroll
Browse files Browse the repository at this point in the history
Fix autoscrolling for editing commands
  • Loading branch information
s-kostyaev authored Jul 8, 2024
2 parents b2ebd3c + 318683b commit 5f33a48
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ellama.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5f33a48

Please sign in to comment.