Skip to content

Commit

Permalink
Merge branch 'master' into select-prompt-for-history-commands
Browse files Browse the repository at this point in the history
  • Loading branch information
clemera committed Jan 9, 2021
2 parents 938d24f + 251b4a5 commit c5466fb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ The format is based on [Keep a Changelog].
default is t) ([#261]).

### Enhancements
* Improved exit behaviour of `selectrum-select-current-candidate`. The
commands gives feedback now when match is required and submission
not possible. Also it allows submission of the prompt when a match
is required and the prompt is a member of candidates ([#338]).
* You can now configure `completion-styles` for the initial filtering
of `selectrum-completion-in-region` using
`selectrum-completion-in-region-styles` ([#331]).
Expand Down Expand Up @@ -190,6 +194,7 @@ The format is based on [Keep a Changelog].
[#334]: https://github.com/raxod502/selectrum/issues/334
[#335]: https://github.com/raxod502/selectrum/pull/335
[#337]: https://github.com/raxod502/selectrum/pull/337
[#338]: https://github.com/raxod502/selectrum/pull/338
[#339]: https://github.com/raxod502/selectrum/pull/339

## 3.0 (released 2020-10-20)
Expand Down
24 changes: 14 additions & 10 deletions selectrum.el
Original file line number Diff line number Diff line change
Expand Up @@ -1458,16 +1458,20 @@ indices."
(user-error "Cannot select a candidate when Selectrum is not active"))
(with-selected-window (active-minibuffer-window)
(let ((index (selectrum--index-for-arg arg)))
(when (or (not selectrum--match-required-p)
(and index (>= index 0))
(and minibuffer-completing-file-name
(file-exists-p
(substitute-in-file-name
(minibuffer-contents))))
(string-empty-p
(minibuffer-contents)))
(selectrum--exit-with
(selectrum--get-candidate index))))))
(if (or (not selectrum--match-required-p)
(string-empty-p
(minibuffer-contents))
(and index (>= index 0))
(if minibuffer-completing-file-name
(file-exists-p
(substitute-in-file-name
(minibuffer-contents)))
(member (minibuffer-contents)
selectrum--refined-candidates)))
(selectrum--exit-with
(selectrum--get-candidate index))
(minibuffer-message
(propertize "Match required" 'face 'minibuffer-prompt))))))

(defun selectrum-submit-exact-input ()
"Exit minibuffer, using the current user input.
Expand Down

0 comments on commit c5466fb

Please sign in to comment.