From 1d91115e2d9b82eaeef417a76eb7507152571edb Mon Sep 17 00:00:00 2001 From: daedsidog <41439659+daedsidog@users.noreply.github.com> Date: Fri, 20 Dec 2024 20:17:56 +0200 Subject: [PATCH] gptel-rewrite: Make text replacement preserve evaporative overlays --- gptel-rewrite.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gptel-rewrite.el b/gptel-rewrite.el index a4bf8a27..74c403ab 100644 --- a/gptel-rewrite.el +++ b/gptel-rewrite.el @@ -258,8 +258,8 @@ BUF is the buffer to modify, defaults to the overlay buffer." do (overlay-put ov 'before-string nil) (with-current-buffer buf (goto-char ov-beg) - (delete-region ov-beg ov-end) - (insert response)))) + (insert response) + (delete-region (point) (+ (point) (- ov-end ov-beg)))))) (message "Replaced region(s) with LLM output in buffer: %s." (buffer-name ov-buf))))