Skip to content

Commit

Permalink
Behave like usual for RET
Browse files Browse the repository at this point in the history
  • Loading branch information
clemera committed May 3, 2020
1 parent 346562e commit 004a86e
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions selectrum.el
Original file line number Diff line number Diff line change
Expand Up @@ -874,14 +874,21 @@ Otherwise just return CANDIDATE."
0 (length candidate)
'(face selectrum-current-candidate) candidate)
(setq selectrum--result
(if (and selectrum--allow-multiple-selection-p
(string-match crm-separator selectrum--previous-input-string))
selectrum--previous-input-string
(apply
#'run-hook-with-args
'selectrum-candidate-selected-hook
candidate selectrum--read-args)
(selectrum--get-full candidate)))
(cond ((and selectrum--allow-multiple-selection-p
(string-match crm-separator selectrum--previous-input-string))
(with-temp-buffer
(insert selectrum--previous-input-string)
(re-search-backward crm-separator)
(goto-char (match-end 0))
(delete-region (point) (point-max))
(insert (selectrum--get-full candidate))
(buffer-string)))
(t
(apply
#'run-hook-with-args
'selectrum-candidate-selected-hook
candidate selectrum--read-args)
(selectrum--get-full candidate))))
(when (string-empty-p selectrum--result)
(setq selectrum--result (or selectrum--default-candidate "")))
(let ((inhibit-read-only t))
Expand Down

0 comments on commit 004a86e

Please sign in to comment.