bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13224: 24.3.50; [PATCH] Variable `icomplete-prospects-height' is no


From: Wesley Dawson
Subject: bug#13224: 24.3.50; [PATCH] Variable `icomplete-prospects-height' is no longer honored
Date: Tue, 18 Dec 2012 21:41:13 -0800


M-x icomplete-mode
M-x set-variable icomplete-prospects-height 1
M-x a
(the candidates list takes up two lines in the minibuffer)

Here's a patch to make icomplete honor `icomplete-prospects-height'
again, which it hasn't since the introduction of `icomplete-separator'
(revno: 111031).

About formatting: the source appears to mix tabs and spaces for
indentation quite freely; I didn't attempt to fix this and went with
what emacs -Q did for formatting.

  * lisp/icomplete.el (icomplete-completions): Fix to honor
    `icomplete-prospects-height' again.

=== modified file 'lisp/icomplete.el'
--- lisp/icomplete.el   2012-12-17 19:43:55 +0000
+++ lisp/icomplete.el   2012-12-19 04:25:35 +0000
@@ -343,8 +343,10 @@
                                (t (concat "…" (substring most compare))))
                               close-bracket)))
             ;;"-prospects" - more than one candidate
-            (prospects-len (+ (length determ) 6 ;; take {,...} into account
-                               (string-width (buffer-string))))
+            (prospects-len (+ (length determ)
+                              (string-width icomplete-separator)
+                              3 ;; take {…} into account
+                              (string-width (buffer-string))))
              (prospects-max
               ;; Max total length to use, including the minibuffer content.
               (* (+ icomplete-prospects-height
@@ -375,7 +377,9 @@
            (cond ((string-equal comp "") (setq most-is-exact t))
                  ((member comp prospects))
                  (t (setq prospects-len
-                           (+ (string-width comp) 1 prospects-len))
+                           (+ (string-width comp)
+                             (string-width icomplete-separator)
+                             prospects-len))
                     (if (< prospects-len prospects-max)
                         (push comp prospects)
                       (setq limit t))))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]