changeset 46516:25e7debccc64

(choose-completion-delete-max-match): Handle minibuffer prompts explicitly.
author Richard M. Stallman <rms@gnu.org>
date Thu, 18 Jul 2002 14:57:46 +0000
parents 272c43ada087
children a308cb6a79fd
files lisp/simple.el
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Thu Jul 18 09:42:56 2002 +0000
+++ b/lisp/simple.el	Thu Jul 18 14:57:46 2002 +0000
@@ -3782,14 +3782,17 @@
 ;; that can be found before POINT.
 (defun choose-completion-delete-max-match (string)
   (let ((opoint (point))
-	(len (min (length string)
-		  (- (point) (point-min)))))
-    (goto-char (- (point) (length string)))
+	len)
+    ;; Try moving back by the length of the string.
+    (goto-char (max (- (point) (length string))
+		    (minibuffer-prompt-end)))
+    ;; See how far back we were actually able to move.  That is the
+    ;; upper bound on how much we can match and delete.
+    (setq len (- opoint (point)))
     (if completion-ignore-case
 	(setq string (downcase string)))
     (while (and (> len 0)
-		(let ((tail (buffer-substring (point)
-					      (+ (point) len))))
+		(let ((tail (buffer-substring (point) opoint)))
 		  (if completion-ignore-case
 		      (setq tail (downcase tail)))
 		  (not (string= tail (substring string 0 len)))))