Fix previous replace-in-string rewrite
* lisp/subr.el (replace-in-string): Fix logic errors in previous patch.
This commit is contained in:
parent
7f9ad5980c
commit
09adf92644
2 changed files with 4 additions and 4 deletions
|
@ -4439,8 +4439,8 @@ Unless optional argument INPLACE is non-nil, return a new string."
|
|||
(unless (= start pos)
|
||||
(push (substring instring start pos) result))
|
||||
(push tostring result)
|
||||
(setq start (+ start (length fromstring))))
|
||||
(unless (= start pos)
|
||||
(setq start (+ pos (length fromstring))))
|
||||
(unless (= start (length instring))
|
||||
(push (substring instring start pos) result))
|
||||
(apply #'concat (nreverse result))))
|
||||
|
||||
|
|
|
@ -462,9 +462,9 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350."
|
|||
"foozotbar"))
|
||||
|
||||
(should (equal (replace-in-string "\377" "x" "a\377b")
|
||||
"axxb"))
|
||||
"axb"))
|
||||
(should (equal (replace-in-string "\377" "x" "a\377ø")
|
||||
"axxø")))
|
||||
"axø")))
|
||||
|
||||
(provide 'subr-tests)
|
||||
;;; subr-tests.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue