branch: externals/company
commit 3831545f8040d51538a68dd571a5f79cbd32ac06
Author: Dmitry Gutov <[email protected]>
Commit: Dmitry Gutov <[email protected]>
Ensure max-len is >= 0; adjust to multiline minibuffer contents too
---
company.el | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/company.el b/company.el
index 43311bcab0..9c483879ff 100644
--- a/company.el
+++ b/company.el
@@ -4721,9 +4721,11 @@ Delay is determined by `company-tooltip-idle-delay'."
(when (and company-echo-truncate-lines
(active-minibuffer-window))
(setq max-len
- (- (window-width (minibuffer-window))
- (buffer-size (window-buffer (minibuffer-window)))
- 4))
+ (max 0
+ (- (window-width (minibuffer-window))
+ (- (point) (save-excursion (vertical-motion 0)
+ (point)))
+ 4)))
(when (> (length company-echo-last-msg) max-len)
(setq company-echo-last-msg (substring company-echo-last-msg 0
max-len))))
;; Avoid modifying the echo area if we don't have anything to say, and we