diff options
author | Thierry Volpiatto <thievol@posteo.net> | 2020-08-16 08:34:51 +0200 |
---|---|---|
committer | Thierry Volpiatto <thievol@posteo.net> | 2020-08-16 08:34:51 +0200 |
commit | 5e74912efb52406dff21fbce9466fa8f1699c3b0 (patch) | |
tree | 19969f17df8c94874e19daae58b01ac7da70e402 /helm-mode.el | |
parent | c72ed13f0007f6d9bc0e1400d97c69e12d0ae6e9 (diff) |
Remove space perhaps added by annotation in the right place (#2365, #2360)
This avoid error when result is not a string like in CRM.
Do this in the right cond clause of helm-completion-in-region--insert-result
instead of doing it earlier in helm--completion-in-region.
Diffstat (limited to 'helm-mode.el')
-rw-r--r-- | helm-mode.el | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/helm-mode.el b/helm-mode.el index 0256f853..053d1c31 100644 --- a/helm-mode.el +++ b/helm-mode.el @@ -1859,14 +1859,7 @@ Can be used for `completion-in-region-function' by advicing it with an ;; to not loose props. (setq string (copy-sequence result)) (helm-completion-in-region--insert-result - ;; When RESULT have annotation, annotation is displayed - ;; in it with a display property attached to a space - ;; added at end of string, take care of removing this - ;; space (issue #2360). However keep RESULT intact to - ;; pass it to `:exit-function' i.e. Don't store the - ;; modified string in STRING. - (replace-regexp-in-string " \\'" "" result) - start point end base-size)) + result start point end base-size)) ;; Allow running extra property `:exit-function' (Issues #2265, ;; #2356). Function is called with 'exact if for a unique ;; match which is exact, the return value of `try-completion' @@ -1893,8 +1886,15 @@ character. Be sure to know what you are doing when modifying this.") (defun helm-completion-in-region--insert-result (result start point end base-size) (cond ((stringp result) + ;; When RESULT have annotation, annotation is displayed + ;; in it with a display property attached to a space + ;; added at end of string, take care of removing this + ;; space (issue #2360). However keep RESULT intact to + ;; pass it to `:exit-function' i.e. Don't store the + ;; modified string in STRING. (choose-completion-string - result (current-buffer) + (replace-regexp-in-string " \\'" "" result) + (current-buffer) (list (+ start base-size) point) completion-list-insert-choice-function) (when helm-completion-mark-suffix |