branch: externals/marginalia commit 1d3af0a6243c13020253fc5a6470c2126e84967c Merge: 9389f38 7fe1a03 Author: Omar Antolín <omar.anto...@gmail.com> Commit: Omar Antolín <omar.anto...@gmail.com>
Merge branch 'base-position' into main --- marginalia.el | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/marginalia.el b/marginalia.el index f5df932..25fb2d5 100644 --- a/marginalia.el +++ b/marginalia.el @@ -641,20 +641,24 @@ The string is transformed according to `marginalia-bookmark-type-transformers'." :truncate (/ marginalia-truncate-width 2) :face 'marginalia-file-name)))) +(declare-function 'selectrum--get-full "ext:selectrum") + (defun marginalia--full-candidate (cand) "Return completion candidate CAND in full. For some completion tables, the completion candidates offered are meant to be only a part of the full minibuffer contents. For example, during file name completion the candidates are one path component of a full file path." - (if-let (win (active-minibuffer-window)) - (with-current-buffer (window-buffer win) - (concat (substring (minibuffer-contents-no-properties) - 0 marginalia--base-position) - cand)) - ;; no minibuffer is active, trust that cand already conveys all - ;; necessary information (there's not much else we can do) - cand)) + (if-let (win (active-minibuffer-window)) + (with-current-buffer (window-buffer win) + (if (bound-and-true-p selectrum-is-active) + (selectrum--get-full cand) + (concat (substring (minibuffer-contents-no-properties) + 0 marginalia--base-position) + cand))) + ;; no minibuffer is active, trust that cand already conveys all + ;; necessary information (there's not much else we can do) + cand)) (defun marginalia--remote-p (path) "Return t if PATH is a remote path."