Skip to content

Commit c60d30c

Browse files
committed
Fix show-paren-mode issue with finished code
1 parent c8cf30b commit c60d30c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

eca-rewrite.el

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ MODEL is the model used."
271271
(hide-show-fn (lambda (&optional restore)
272272
(let ((disp (overlay-get ov 'display))
273273
(stored (overlay-get ov 'eca-rewrite--ediff)))
274-
(overlay-put ov 'face (and restore 'eca-rewrite-highlight-face))
274+
;; Do not toggle overlay-level face; the highlight is carried by the display string.
275275
(overlay-put ov 'display (and restore stored))
276276
(overlay-put ov 'eca-rewrite--ediff (unless restore disp)))))
277277
(on-quit-fn (lambda ()
@@ -304,8 +304,7 @@ MODEL is the model used."
304304
(setq eca-rewrite--last-prompt prompt)
305305
(when ov (eca-rewrite--reject ov))
306306
(eca-rewrite--send session text path start end prompt)
307-
(unless (get-char-property (point) 'eca-rewrite--id)
308-
(when (= (point) (region-end)) (backward-char 1)))
307+
(goto-char start)
309308
(deactivate-mark))
310309

311310
(defun eca-rewrite--send (session text path start end prompt)
@@ -365,9 +364,10 @@ so shorter rewrites don't leave leftover original text in the overlay."
365364
(let ((plain (buffer-substring-no-properties (point-min) (point-max)))
366365
(propertized (buffer-substring (point-min) (point-max))))
367366
(overlay-put ov 'eca-rewrite--new-text plain)
368-
;; Display only the rewritten content; the overlay spans the entire
369-
;; original region, so any leftover original text is fully hidden.
370-
(overlay-put ov 'display propertized)))))
367+
;; Move the highlight to the display string so show-paren-mode
368+
;; overlays on buffer text don't repaint the whole overlay.
369+
(let ((disp (copy-sequence propertized)))
370+
(overlay-put ov 'display disp))))))
371371

372372
;; Public
373373

0 commit comments

Comments
 (0)