diff --git a/extensions/vi-mode/tests/ex.lisp b/extensions/vi-mode/tests/ex.lisp index 918e463b8..a676cea71 100644 --- a/extensions/vi-mode/tests/ex.lisp +++ b/extensions/vi-mode/tests/ex.lisp @@ -21,7 +21,18 @@ (with-vi-buffer (#?"[p]en pineapple apple pen\napple juice\npineapple cake\n") (cmd "Vj") (ex-cmd "'<,'>s/apple/grape") - (ok (text= #?"pen pinegrape apple pen\ngrape juice\npineapple cake\n")))) + (ok (text= #?"pen pinegrape apple pen\ngrape juice\npineapple cake\n"))) + + ;; Regexp Replacements + (with-vi-buffer (#?"line 1\nl[i]ne 2\nline 3\nline 4\n") + (cmd "Vj") + (ex-cmd "'<,'>s/^/foo - /") + (ok (text= #?"line 1\nfoo - line 2\nfoo - line 3\nline 4\n"))) + (with-vi-buffer (#?"line 1\nl[i]ne 2\nline 3\nline 4\n") + (cmd "Vj") + (ex-cmd "'<,'>s/$/ - bar/") + (ok (text= #?"line 1\nline 2 - bar\nline 3 - bar\nline 4\n"))) + ) (testing "'g' flag" (with-vi-buffer (#?"pen pineapple le juice\npineapple cake\n") (ex-cmd "'<,'>s/apple/grape/g") diff --git a/src/ext/isearch.lisp b/src/ext/isearch.lisp index 1cd8553a4..cfd90b574 100644 --- a/src/ext/isearch.lisp +++ b/src/ext/isearch.lisp @@ -187,12 +187,13 @@ (return-from highlight-region nil)) (with-point ((p start-point)) (loop - (unless (funcall *isearch-search-forward-function* p search-string end-point) - (return)) - (with-point ((before p)) - (funcall *isearch-search-backward-function* before search-string) - (isearch-add-overlay buffer - (make-overlay before p 'isearch-highlight-attribute))))) + (unless (or (funcall *isearch-search-forward-function* p search-string end-point) + (point= start-point end-point))) + (return)) + (with-point ((before p)) + (funcall *isearch-search-backward-function* before search-string) + (isearch-add-overlay buffer + (make-overlay before p 'isearch-highlight-attribute)))) (isearch-sort-overlays buffer)))) (defun isearch-update-display ()