changeset 93101:98814f79eb94

(icomplete-completions): While collecting the list of prospective candidates, don't overshoot `icomplete-prospects-length'.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 20 Mar 2008 10:28:11 +0000
parents 4e7095d02b7a
children cabe16b2ac03
files lisp/icomplete.el
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/icomplete.el	Thu Mar 20 09:17:22 2008 +0000
+++ b/lisp/icomplete.el	Thu Mar 20 10:28:11 2008 +0000
@@ -299,17 +299,19 @@
 				  (substring most (length name))
 				  close-bracket-determined)))
 	     ;;"-prospects" - more than one candidate
-	     (prospects-len 0)
-	     prospects most-is-exact comp)
+	     (prospects-len (+ (length determ) 6)) ;; take {,...} into account
+	     prospects most-is-exact comp limit)
 	(if (eq most-try t)
 	    (setq prospects nil)
-	  (while (and comps (< prospects-len icomplete-prospects-length))
+	  (while (and comps (not limit))
 	    (setq comp (substring (car comps) most-len)
 		  comps (cdr comps))
 	    (cond ((string-equal comp "") (setq most-is-exact t))
 		  ((member comp prospects))
-		  (t (setq prospects (cons comp prospects)
-			   prospects-len (+ (length comp) 1 prospects-len))))))
+		  (t (setq prospects-len (+ (length comp) 1 prospects-len))
+		     (if (< prospects-len icomplete-prospects-length)
+			 (setq prospects (cons comp prospects))
+		       (setq limit t))))))
 	(if prospects
 	    (concat determ
 		    "{"