branch: externals/consult
commit 99fcdf3b64de2f48a834a6d7bde028996ed13687
Author: Daniel Mendler <m...@daniel-mendler.de>
Commit: Daniel Mendler <m...@daniel-mendler.de>

    consult-completion-in-region: Pass metadata to completion-all-completions
---
 consult.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/consult.el b/consult.el
index b3ab5acb4f..6888986803 100644
--- a/consult.el
+++ b/consult.el
@@ -3289,8 +3289,15 @@ expected return value are as specified for 
`completion-in-region'."
   (barf-if-buffer-read-only)
   (let* ((initial (buffer-substring-no-properties start end))
          (metadata (completion-metadata initial collection predicate))
+         ;; bug#75910: category instead of `minibuffer-completing-file-name'
+         (minibuffer-completing-file-name
+          (eq 'file (completion-metadata-get metadata 'category)))
          (threshold (completion--cycle-threshold metadata))
-         (all (completion-all-completions initial collection predicate (length 
initial))))
+         (all (completion-all-completions initial collection predicate
+                                          (if (<= start (point) end)
+                                              (- (point) start)
+                                            (length initial))
+                                          metadata)))
     ;; Normalize improper list
     (when-let ((last (last all)))
       (setcdr last nil))
@@ -3298,9 +3305,6 @@ expected return value are as specified for 
`completion-in-region'."
             (and completion-cycling completion-all-sorted-completions))
         (completion--in-region start end collection predicate)
       (let* ((this-command #'consult-completion-in-region)
-             ;; bug#75910: category instead of 
`minibuffer-completing-file-name'
-             (minibuffer-completing-file-name
-              (eq 'file (completion-metadata-get metadata 'category)))
              ;; Wrap all annotation functions to ensure that they are executed
              ;; in the original buffer.
              (exit-fun (plist-get completion-extra-properties :exit-function))

Reply via email to