(base-size (length base))
(prompt-end (minibuffer-prompt-end)))
(setq completion--input nil)
- (if (and string (<= (+ prompt-end base-size (length string)) (point-max))
- ;; Don't restore if the base has changed.
- (equal base (buffer-substring-no-properties
- prompt-end (+ prompt-end base-size))))
- (completion--replace (+ prompt-end base-size) (point-max) string)
- (user-error "No partial completion input to restore"))))
+ (unless (and string (<= (+ prompt-end base-size) (point-max))
+ ;; Don't restore if the base part has changed.
+ (equal base (buffer-substring-no-properties
+ prompt-end (+ prompt-end base-size))))
+ (user-error "No partial completion input to restore"))
+ (completion--replace (+ prompt-end base-size) (point-max) string)
+ (when (get-buffer-window "*Completions*" 0)
+ ;; Refresh *Completions* buffer, if already visible.
+ (minibuffer-completion-help))))
(defun minibuffer-force-complete (&optional start end dont-cycle)
"Complete the minibuffer to an exact match.