From: Richard M. Stallman Date: Thu, 18 Jul 2002 14:57:46 +0000 (+0000) Subject: (choose-completion-delete-max-match): Handle minibuffer prompts explicitly. X-Git-Tag: ttn-vms-21-2-B4~14007 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f0bfada77f91079860d019b65ffd696680b55439;p=emacs.git (choose-completion-delete-max-match): Handle minibuffer prompts explicitly. --- diff --git a/lisp/simple.el b/lisp/simple.el index 564aac03541..d1026e6ff6b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3782,14 +3782,17 @@ With prefix argument N, move N items (negative N means move backward)." ;; 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)))))