Fix duplicate foreground property in face when updating tp-text

Changed from using tp-add to set-text-properties when text content is
same but properties differ. This prevents duplicate property merging
since merged-props already contains the complete set of properties.

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-05 19:16:19 +00:00
parent 467a4c16f4
commit 45268b6e5a

4
tp.el
View File

@ -1012,8 +1012,8 @@ Text properties embedded in NEW-TEXT are merged with PROPS."
(old-text (buffer-substring-no-properties m-start m-end))) (old-text (buffer-substring-no-properties m-start m-end)))
(if (equal old-text (substring-no-properties new-text)) (if (equal old-text (substring-no-properties new-text))
;; Text content is the same, but properties may differ ;; Text content is the same, but properties may differ
;; Use tp-add to update properties (merges embedded props from new-text) ;; Use set-text-properties to replace with merged properties
(tp-add m-start m-end merged-props) (set-text-properties m-start m-end merged-props)
;; Text content is different - delete old text and insert new ;; Text content is different - delete old text and insert new
(delete-region m-start m-end) (delete-region m-start m-end)
(goto-char m-start) (goto-char m-start)