From 0032652154e2fe144b752970368c4f7274307bdb Mon Sep 17 00:00:00 2001 From: Nathaniel Nicandro Date: Tue, 16 Jan 2018 11:41:38 -0600 Subject: [PATCH] Cleanup prefix handling when constructing completion candidates --- jupyter-repl-client.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/jupyter-repl-client.el b/jupyter-repl-client.el index 7984763..2fc4dbb 100644 --- a/jupyter-repl-client.el +++ b/jupyter-repl-client.el @@ -1148,15 +1148,18 @@ elements of MATCHES." ;; TODO: Handle cases in the Jupyter repl when ;; `company-minimum-prefix-length' is 1 and the prefix is '=' (let ((types (plist-get metadata :_jupyter_types_experimental))) - (let ((matches matches) match) + (let ((matches matches) + ;; TODO: This may not be the most general way to use start and end + (prefix (seq-subseq prefix 0 (- (length prefix) + (- end start)))) + match) (while (setq match (car matches)) ;; TODO: Maybe set the match property when it doesn't have the prefix, ;; indicating that it should replace part of the prefix? (unless (string-prefix-p prefix match) - ;; FIXME: Note that prefix is not the code cent to the kernel in some + ;; FIXME: Note that prefix is not the code sent to the kernel in some ;; cases, but the symbol behind point - (setcar matches (concat (seq-subseq prefix (- end start)) - (car matches)))) + (setcar matches (concat prefix (car matches)))) ;; (put-text-property 0 1 'match match-start (car matches)) (setq matches (cdr matches)))) (when types