feat(emacs/lean-company): truncate string if it's longer than 90% of window-width
Also add "..." in the end Close #137
This commit is contained in:
parent
561753e7f1
commit
db60a56056
1 changed files with 6 additions and 4 deletions
|
@ -53,12 +53,14 @@ triggers a completion immediately."
|
||||||
(candidate-len (length candidate))
|
(candidate-len (length candidate))
|
||||||
(entry-width (+ candidate-len
|
(entry-width (+ candidate-len
|
||||||
annotation-len))
|
annotation-len))
|
||||||
(window-width (window-body-width)))
|
(allowed-width (truncate (* 0.90 (window-body-width)))))
|
||||||
(when (> entry-width window-width)
|
(when (> entry-width allowed-width)
|
||||||
(setq annotation-str
|
(setq annotation-str
|
||||||
|
(concat
|
||||||
(substring-no-properties annotation-str
|
(substring-no-properties annotation-str
|
||||||
0
|
0
|
||||||
(- window-width candidate-len))))
|
(- allowed-width candidate-len 3))
|
||||||
|
"...")))
|
||||||
annotation-str))))
|
annotation-str))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
Loading…
Reference in a new issue