* lisp/subr.el (replace-in-string): Fix logic errors in previous
patch.
(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))))
"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