]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/isearch.el (isearch-del-char): Don't exceed the length of `isearch-string'
authorJuri Linkov <juri@jurta.org>
Thu, 13 Jun 2013 21:11:42 +0000 (00:11 +0300)
committerJuri Linkov <juri@jurta.org>
Thu, 13 Jun 2013 21:11:42 +0000 (00:11 +0300)
by the prefix arg.

Fixes: debbugs:14563
lisp/ChangeLog
lisp/isearch.el

index 974fad3e3069fa2c0b2d16f1c11a96823ed47c1e..f21f6e4b068b5f5b2433a41a493c29e8514b0941 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-13  Juri Linkov  <juri@jurta.org>
+
+       * isearch.el (isearch-del-char): Don't exceed the length of
+       `isearch-string' by the prefix arg.  (Bug#14563)
+
 2013-06-13  Juri Linkov  <juri@jurta.org>
 
        * isearch.el (isearch-yank-word, isearch-yank-line)
index 4754f86d5d770fae558a3f1c11dad56ce83ea469..ddb5ba9331cc1dbb0be5743c404f5cc2972fc23f 100644 (file)
@@ -1815,11 +1815,17 @@ If search string is empty, just beep."
   (interactive "p")
   (if (= 0 (length isearch-string))
       (ding)
-    (setq isearch-string (substring isearch-string 0 (- (or arg 1)))
+    (setq isearch-string (substring isearch-string 0
+                                   (- (min (or arg 1)
+                                           (length isearch-string))))
           isearch-message (mapconcat 'isearch-text-char-description
                                      isearch-string "")))
   ;; Use the isearch-other-end as new starting point to be able
   ;; to find the remaining part of the search string again.
+  ;; This is like what `isearch-search-and-update' does,
+  ;; but currently it doesn't support deletion of characters
+  ;; for the case where unsuccessful search may become successful
+  ;; by deletion of characters.
   (if isearch-other-end (goto-char isearch-other-end))
   (isearch-search)
   (isearch-push-state)