Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions gptel.el
Original file line number Diff line number Diff line change
Expand Up @@ -1009,13 +1009,14 @@ Later plists in the sequence take precedence over earlier ones."
"Scroll window if LLM response continues below viewport.

Note: This will move the cursor."
(when-let* ((win (get-buffer-window (current-buffer) 'visible))
((not (pos-visible-in-window-p (point) win)))
(scroll-error-top-bottom t))
(condition-case nil
(with-selected-window win
(scroll-up-command))
(error nil))))
(run-at-time ;Scheduled on the event loop to call from outside save-excursion
0 nil (lambda ()
(when-let* ((win (get-buffer-window (current-buffer) 'visible))
((not (pos-visible-in-window-p (point) win)))
(scroll-error-top-bottom t))
(condition-case nil
(with-selected-window win (scroll-up-command))
(error nil))))))

(defun gptel-beginning-of-response (&optional _ _ arg)
"Move point to the beginning of the LLM response ARG times."
Expand Down