Consider a single newline terminated string as single line
* eldoc-box.el (eldoc-box--eldoc-message-function): Trim newlines in DOC. Rename 'multi-line-p' to 'single-line-p'.
This commit is contained in:
parent
d4574ee392
commit
eb694dde6b
@ -405,10 +405,10 @@ Checkout `lsp-ui-doc--make-frame', `lsp-ui-doc--move-frame'."
|
|||||||
(defun eldoc-box--eldoc-message-function (str &rest args)
|
(defun eldoc-box--eldoc-message-function (str &rest args)
|
||||||
"Front-end for eldoc. Display STR in childframe and ARGS works like `message'."
|
"Front-end for eldoc. Display STR in childframe and ARGS works like `message'."
|
||||||
(when (and (stringp str) (not (equal str "")))
|
(when (and (stringp str) (not (equal str "")))
|
||||||
(let* ((doc (apply #'format str args))
|
(let* ((doc (string-trim-right (apply #'format str args)))
|
||||||
(multi-line-p (and eldoc-box-only-multi-line
|
(single-line-p (and eldoc-box-only-multi-line
|
||||||
(eq (cl-count ?\n doc) 0))))
|
(eq (cl-count ?\n doc) 0))))
|
||||||
(unless multi-line-p
|
(unless single-line-p
|
||||||
(eldoc-box--display doc)
|
(eldoc-box--display doc)
|
||||||
(setq eldoc-box--last-point (point))
|
(setq eldoc-box--last-point (point))
|
||||||
;; Why a timer? ElDoc is mainly used in minibuffer,
|
;; Why a timer? ElDoc is mainly used in minibuffer,
|
||||||
@ -420,7 +420,7 @@ Checkout `lsp-ui-doc--make-frame', `lsp-ui-doc--move-frame'."
|
|||||||
;; command if `eldoc-box-hover-mode' is on and `eldoc-last-message' is not nil.
|
;; command if `eldoc-box-hover-mode' is on and `eldoc-last-message' is not nil.
|
||||||
(setq eldoc-box--cleanup-timer
|
(setq eldoc-box--cleanup-timer
|
||||||
(run-with-timer eldoc-box-cleanup-interval nil #'eldoc-box--maybe-cleanup)))
|
(run-with-timer eldoc-box-cleanup-interval nil #'eldoc-box--maybe-cleanup)))
|
||||||
multi-line-p)))
|
single-line-p)))
|
||||||
|
|
||||||
;;;; Eglot helper
|
;;;; Eglot helper
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user