branch: externals/marginalia
commit a5ce6aab48827a3b569d882dd9b2e653527f9f9a
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
Work around `completion-boundaries' bug in Emacs 27.1
See #67
---
marginalia.el | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/marginalia.el b/marginalia.el
index ffc68b2..b9404c7 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -649,11 +649,15 @@ The string is transformed according to
`marginalia-bookmark-type-transformers'."
(pt (- (point) (minibuffer-prompt-end)))
(before (substring contents 0 pt))
(after (substring contents pt))
- (bounds (completion-boundaries
- before
- minibuffer-completion-table
- minibuffer-completion-predicate
- after))
+ ;; BUG: `completion-boundaries` fails for `partial-completion`
+ ;; if the cursor is moved between the slashes of "~//".
+ ;; See also vertico.el.
+ (bounds (or (condition-case nil
+ (completion-boundaries before
+
minibuffer-completion-table
+
minibuffer-completion-predicate
+ after)
+ (t (cons 0 (length after))))))
(components (split-string (substring before 0 (car bounds))
"/"))
(num-replace (if (string-suffix-p "/" file)
(cl-count ?/ file)