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
1 changed files with 7 additions and 2 deletions
|
@ -1413,10 +1413,15 @@ To return to ordinary Occur mode, use \\[occur-cease-edit]."
|
||||||
(length s1)))))
|
(length s1)))))
|
||||||
(prefix-len (funcall common-prefix buf-str text))
|
(prefix-len (funcall common-prefix buf-str text))
|
||||||
(suffix-len (funcall common-prefix
|
(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 beg-pos (+ beg-pos prefix-len))
|
||||||
(setq end-pos (- end-pos suffix-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)
|
(delete-region beg-pos end-pos)
|
||||||
(goto-char beg-pos)
|
(goto-char beg-pos)
|
||||||
(insert text)))
|
(insert text)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue