Skip to content

Commit 6ff7263

Browse files
committed
Fix hilit-chg highlighting of characters where text has been removed
* lisp/hilit-chg.el (hilit-chg-set-face-on-change): Remove highlighting from characters that are just highlighted because of something that has been previously deleted (bug#17784).
1 parent 8168a79 commit 6ff7263

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

lisp/hilit-chg.el

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,9 @@ This allows you to manually remove highlighting from uninteresting changes."
492492
;; otherwise an undone change shows up as changed. While the properties
493493
;; are automatically restored by undo, we must fix up the overlay.
494494
(save-match-data
495-
(let (;;(beg-decr 1)
496-
(end-incr 1)
497-
(type 'hilit-chg))
495+
(let ((end-incr 1)
496+
(type 'hilit-chg)
497+
(property 'hilit-chg))
498498
(if undo-in-progress
499499
(if (and highlight-changes-mode
500500
highlight-changes-visible-mode)
@@ -515,22 +515,24 @@ This allows you to manually remove highlighting from uninteresting changes."
515515
;; (setq beg-decr 0))))
516516
;; (setq beg (max (- beg beg-decr) (point-min)))
517517
(setq end (min (+ end end-incr) (point-max)))
518-
(setq type 'hilit-chg-delete))
518+
(setq type 'hilit-chg-delete
519+
property 'hilit-chg-delete))
519520
;; Not a deletion.
520521
;; Most of the time the following is not necessary, but
521522
;; if the current text was marked as a deletion then
522523
;; the old overlay is still in effect. So if the user adds some
523524
;; text where she earlier deleted text, we have to remove the
524525
;; deletion marking, and replace it explicitly with a `changed'
525526
;; marking, otherwise its highlighting would disappear.
526-
(if (eq (get-text-property end 'hilit-chg) 'hilit-chg-delete)
527-
(save-restriction
528-
(widen)
529-
(put-text-property end (+ end 1) 'hilit-chg 'hilit-chg)
530-
(if highlight-changes-visible-mode
531-
(hilit-chg-fixup end (+ end 1))))))
527+
(when (eq (get-text-property end 'hilit-chg-delete)
528+
'hilit-chg-delete)
529+
(save-restriction
530+
(widen)
531+
(put-text-property end (+ end 1) 'hilit-chg-delete nil)
532+
(if highlight-changes-visible-mode
533+
(hilit-chg-fixup end (+ end 1))))))
532534
(unless no-property-change
533-
(put-text-property beg end 'hilit-chg type))
535+
(put-text-property beg end property type))
534536
(if (or highlight-changes-visible-mode no-property-change)
535537
(hilit-chg-make-ov type beg end)))))))
536538

0 commit comments

Comments
 (0)