branch: master
commit fbf654c2276ec667d8ff08403338320e58633043
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
counsel.el (counsel-company): Rely on company-prefix if company-common is
nil
Fixes #2074
---
counsel.el | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/counsel.el b/counsel.el
index 10b2390..8721280 100644
--- a/counsel.el
+++ b/counsel.el
@@ -397,13 +397,17 @@ Update the minibuffer with the amount of lines collected
every
(company-mode 1)
(unless company-candidates
(company-complete))
- (when company-common
- (setq ivy-completion-beg (- (point) (length company-common)))
- (setq ivy-completion-end (point))
- (ivy-read "company cand: " company-candidates
- :action #'ivy-completion-in-region-action
- :unwind #'company-abort
- :caller 'counsel-company)))
+ (let ((len (cond (company-common
+ (length company-common))
+ (company-prefix
+ (length company-prefix)))))
+ (when len
+ (setq ivy-completion-beg (- (point) len))
+ (setq ivy-completion-end (point))
+ (ivy-read "company cand: " company-candidates
+ :action #'ivy-completion-in-region-action
+ :unwind #'company-abort
+ :caller 'counsel-company))))
;;** `counsel-irony'
(declare-function irony-completion-candidates-async "ext:irony-completion")