branch: externals/capf-autosuggest
commit 6432d5f23b4bc14d8dcb8b27de3b56d080d7822a
Author: jakanakaevangeli <[email protected]>
Commit: jakanakaevangeli <[email protected]>

    Avoid error if all-completions returns invalid strings
---
 capf-autosuggest.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/capf-autosuggest.el b/capf-autosuggest.el
index c757fe3..086358a 100644
--- a/capf-autosuggest.el
+++ b/capf-autosuggest.el
@@ -121,6 +121,9 @@ point forward."
                    ;; as we only use the string without the prefix for the
                    ;; overlay.
                    (all-completions string table pred)))
+                ;; `all-completions' may return strings that don't strictly
+                ;; match on our prefix. Ignore them.
+                ((string-prefix-p (substring string base) (car completions)))
                 (str (substring (car completions) (- end beg base)))
                 ((/= 0 (length str))))
              (setq capf-autosuggest--region (cons beg end)

Reply via email to