summaryrefslogtreecommitdiff
path: root/lisp/isearch.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@jurta.org>2013-06-14 00:11:42 +0300
committerJuri Linkov <juri@jurta.org>2013-06-14 00:11:42 +0300
commitcb89acab6cdfa418d1d14ad3200712e1dd406673 (patch)
treea592f3b158e038a6a2149964ebfd9790810cd017 /lisp/isearch.el
parent6e8cfc81e747bef8edd1f5df2c25b6a00c766a03 (diff)
downloademacs-cb89acab6cdfa418d1d14ad3200712e1dd406673.tar.gz
* lisp/isearch.el (isearch-del-char): Don't exceed the length of `isearch-string'
by the prefix arg. Fixes: debbugs:14563
Diffstat (limited to 'lisp/isearch.el')
-rw-r--r--lisp/isearch.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 4754f86d5d7..ddb5ba9331c 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -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)