From 2b374cd51728d05373838d554ab0459d650f93e4 Mon Sep 17 00:00:00 2001 From: Sebastian Ullrich Date: Tue, 10 Jan 2017 10:47:49 +0100 Subject: [PATCH] fix(emacs/lean-company): do not highlight prefix of non-prefix match --- src/emacs/lean-company.el | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/emacs/lean-company.el b/src/emacs/lean-company.el index b0ea105140..481bd30fce 100644 --- a/src/emacs/lean-company.el +++ b/src/emacs/lean-company.el @@ -24,11 +24,9 @@ (company-mode t)) (cl-defun company-lean--make-candidate (prefix &key text type) - (let ((start (s-index-of prefix text))) - (propertize text - 'type type - 'start start - 'prefix prefix))) + (propertize text + 'type type + 'prefix prefix)) (defun company-lean--handle-singleton-candidate (prefix candidates) "Handle singleton candidate. If the candidate does not start @@ -85,11 +83,9 @@ (defun company-lean--match (arg) "Return the end of matched region" - (let ((prefix (get-text-property 0 'prefix arg)) - (start (get-text-property 0 'start arg))) - (if start - (+ start (length prefix)) - 0))) + (let ((prefix (get-text-property 0 'prefix arg))) + (when (eq (s-index-of prefix arg) 0) + (length prefix)))) (defun company-lean (command &optional arg &rest ignored) (cl-case command