branch: externals/company
commit 8d599ebc8a9aca27c0a6157aeb31c5b7f05ed0a3
Author: Dmitry Gutov <dmi...@gutov.dev>
Commit: Dmitry Gutov <dmi...@gutov.dev>

    company-capf--post-completion: Improve eshell compatibility
    
    It (as opposed to 'M-x shell' already) really needs the full prefix string, 
not
    just up to the closest boundary.
    
    Disables the insertion of space, fixes restarting after directory 
completion.
---
 company-capf.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/company-capf.el b/company-capf.el
index baeacaa283..8d159608c9 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -238,7 +238,8 @@ so we can't just use the preceding variable instead.")
 (defun company-capf--post-completion (arg)
   (let* ((res company-capf--current-completion-data)
          (exit-function (plist-get (nthcdr 4 res) :exit-function))
-         (table (nth 3 res)))
+         (table (nth 3 res))
+         (prefix (nth 0 (company-capf--prefix))))
     (if exit-function
         ;; Follow the example of `completion--done'.
         (funcall exit-function arg
@@ -247,8 +248,8 @@ so we can't just use the preceding variable instead.")
                  ;; particular candidate explicitly (it only checks whether
                  ;; further completions exist). Whereas company user can press
                  ;; RET (or use implicit completion with company-tng).
-                 (if (= (car (completion-boundaries arg table nil ""))
-                        (length arg))
+                 (if (= (car (completion-boundaries prefix table nil ""))
+                        (length prefix))
                      'exact
                    'finished)))))
 

Reply via email to