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:
parent
e81e375539
commit
f22e9ba9ac
@ -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)))
|
||||
|
Loading…
Reference in New Issue
Block a user