emacs-diffs
[Top][All Lists]
Advanced

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

master a96954b982d: icomplete-completions: Revise computation of prospec


From: Sean Whitton
Subject: master a96954b982d: icomplete-completions: Revise computation of prospects-len
Date: Sat, 5 Oct 2024 03:43:43 -0400 (EDT)

branch: master
commit a96954b982ddd441ac943bfa48015fb4775c00cb
Author: Sean Whitton <spwhitton@spwhitton.name>
Commit: Sean Whitton <spwhitton@spwhitton.name>

    icomplete-completions: Revise computation of prospects-len
    
    * lisp/icomplete.el (icomplete-completions): Revise computation of
    prospects-len (i) to avoid calling string-width on the entire
    buffer-string, which could be slow; and (ii) to better handle minibuffer
    prompts with embedded newlines (bug#72826).
---
 lisp/icomplete.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 2ea5e36fa88..9497b46c6cf 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -1007,7 +1007,12 @@ matches exist."
                                   (or determ (concat open-bracket 
close-bracket)))
                                  (string-width icomplete-separator)
                                  (+ 2 (string-width ellipsis)) ;; take {…} 
into account
-                                 (string-width (buffer-string))))
+                                 (string-width
+                                  (buffer-substring
+                                   (save-excursion
+                                     (goto-char (icomplete--field-beg))
+                                     (pos-bol))
+                                   (icomplete--field-end)))))
                (prospects-max
                 ;; Max total length to use, including the minibuffer content.
                 (* (+ icomplete-prospects-height



reply via email to

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