* lisp/minibuffer.el (minibuffer-force-complete-and-exit): Use
base size as determined by 'completion-all-sorted-completions',
instead of the beginning of current completion field (from
'completion-boundaries'). Those can differ when
'partial-completion' picks up part of the previous fields. For
example, in file name completion with input "emacs/lisp/pr/xr",
we want to replace also the last field "pr" when completing to
"emacs/lisp/progmodes/xref.el".
\\[exit-minibuffer] when you know you want the first
completion even before cycling to it."
(interactive "" minibuffer-mode)
- (if-let ((beg-end (minibuffer--completion-boundaries))
- (beg (car beg-end)) (end (cdr beg-end))
+ (if-let ((beg (minibuffer-prompt-end))
+ (end (cdr (minibuffer--completion-boundaries)))
(all (completion-all-sorted-completions beg end)))
(progn
- (completion--replace beg end (car all))
+ (completion--replace (+ (minibuffer-prompt-end)
+ (or (cdr (last all)) 0))
+ end (car all))
(completion--done (buffer-substring-no-properties beg (point))
'finished)
(exit-minibuffer))