Skip to content

Commit

Permalink
Fix minor bug with role-toggling
Browse files Browse the repository at this point in the history
  • Loading branch information
daedsidog committed Jul 25, 2024
1 parent e9d947c commit 2f7a508
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions gptel.el
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ file."
;; Minor mode and UI

;; NOTE: It's not clear that this is the best strategy:
(add-to-list 'text-property-default-nonsticky '(gptel . t))
(add-to-list 'text-property-default-nonsticky '(gptel . nil))

(defface gptel-response-highlight-face
'((((class color) (min-colors 257) (background light))
Expand Down Expand Up @@ -939,11 +939,13 @@ If a region is selected, modifies the region. Otherwise, modifies at the point.
;; sure to fill it with the role at the start of the region.
(dst-type (cl-loop for i from start while (< i end)
thereis (unless (eq type (get-text-property i 'gptel))
type)
(unless type
'query))
finally (cl-return (if (eq type 'response)
nil
'query
'response)))))
(put-text-property start end 'gptel dst-type)))))
(setq dst-type (if (eq dst-type 'query-placeholder) nil dst-type))
(put-text-property start end 'gptel dst-type)))))

(defun gptel--update-status (&optional msg face)
"Update status MSG in FACE."
Expand Down

0 comments on commit 2f7a508

Please sign in to comment.