emacs-diffs
[Top][All Lists]
Advanced

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

master 9cbd25e5cdd: Handle point not at EOB in minibuffer-choose-complet


From: Juri Linkov
Subject: master 9cbd25e5cdd: Handle point not at EOB in minibuffer-choose-completion
Date: Wed, 14 Jun 2023 13:32:20 -0400 (EDT)

branch: master
commit 9cbd25e5cdd3881a024da8279f42fb8a8115b688
Author: Spencer Baugh <sbaugh@janestreet.com>
Commit: Juri Linkov <juri@linkov.net>

    Handle point not at EOB in minibuffer-choose-completion
    
    Without this change, only the minibuffer contents before point are
    cleared when a completion is chosen, which results in stray text when
    point is in the middle of the minibuffer.
    
    After this change, we heuristically decide either to clear the whole
    buffer or only part of it, taking into account the location of point.
    
    * lisp/minibuffer.el (minibuffer-completion-help): Use point when
    calculating completion-base-affixes. (Bug#62700)
---
 lisp/minibuffer.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 539206a19e4..d079dc0bcdf 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2395,7 +2395,11 @@ These include:
              (prefix (unless (zerop base-size) (substring string 0 base-size)))
              (base-prefix (buffer-substring (minibuffer--completion-prompt-end)
                                             (+ start base-size)))
-             (base-suffix (buffer-substring (point) (point-max)))
+             (base-suffix
+              (if (eq (alist-get 'category (cdr md)) 'file)
+                  (buffer-substring (save-excursion (or (search-forward "/" 
nil t) (point-max)))
+                                    (point-max))
+                ""))
              (all-md (completion--metadata (buffer-substring-no-properties
                                             start (point))
                                            base-size md



reply via email to

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