1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-03 08:30:09 +00:00

Fix regression in Occur Edit mode

* lisp/replace.el (occur-after-change-function): Fix the algorithm
to find the smallest change in some corner cases.  (Bug#53598)
This commit is contained in:
Eli Zaretskii 2022-01-30 08:49:34 +02:00
parent e81e375539
commit f22e9ba9ac

View File

@ -1413,10 +1413,15 @@ To return to ordinary Occur mode, use \\[occur-cease-edit]."
(length s1)))))
(prefix-len (funcall common-prefix buf-str text))
(suffix-len (funcall common-prefix
(reverse buf-str) (reverse text))))
(reverse (substring
buf-str prefix-len))
(reverse (substring
text prefix-len)))))
(setq beg-pos (+ beg-pos prefix-len))
(setq end-pos (- end-pos suffix-len))
(setq text (substring text prefix-len (- suffix-len)))
(setq text (substring text prefix-len
(and (not (zerop suffix-len))
(- suffix-len))))
(delete-region beg-pos end-pos)
(goto-char beg-pos)
(insert text)))