]> git.eshelyaron.com Git - emacs.git/commitdiff
(isearch-search-fun): Compare the length of the
authorJuri Linkov <juri@jurta.org>
Tue, 11 Nov 2008 19:43:09 +0000 (19:43 +0000)
committerJuri Linkov <juri@jurta.org>
Tue, 11 Nov 2008 19:43:09 +0000 (19:43 +0000)
current search string with the length of the string from the
previous search state to detect the situation when the user
adds or removes characters in the search string.
Use word-search-forward-lax and word-search-backward-lax in this
case, and otherwise word-search-forward and word-search-backward.

lisp/isearch.el

index 525106246d4e97ba7463386ecee736e4776a1d41..ac911de3ffb6292f0e817f88aee9408c62d7963d 100644 (file)
@@ -2178,7 +2178,12 @@ Can be changed via `isearch-search-fun-function' for special needs."
       (funcall isearch-search-fun-function)
     (cond
      (isearch-word
-      (if isearch-forward 'word-search-forward-lax 'word-search-backward-lax))
+      ;; Use lax versions to not fail at the end of the word while the user
+      ;; adds and removes characters in the search string
+      (if (not (eq (length isearch-string)
+                  (length (isearch-string-state (car isearch-cmds)))))
+         (if isearch-forward 'word-search-forward-lax 'word-search-backward-lax)
+       (if isearch-forward 'word-search-forward 'word-search-backward)))
      (isearch-regexp
       (if isearch-forward 're-search-forward 're-search-backward))
      (t