diff options
author | Augusto Stoffel <arstoffel@gmail.com> | 2022-03-24 15:05:39 +0000 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2022-03-24 15:06:05 +0000 |
commit | 45978f97be89ae989ecf9e7129b88592e70a1f24 (patch) | |
tree | 0de27d6816f030d31302a0d77d62c7b1c41cfcc3 | |
parent | 17d9830f469ac57838b04fc7e9fc0bed4f1f3191 (diff) | |
download | emacs-45978f97be89ae989ecf9e7129b88592e70a1f24.tar.gz |
Handle invisible text in Eldoc when calculating size
Co-authored-by: João Távora <joaotavora@gmail.com>
* lisp/emacs-lisp/eldoc.el (eldoc--echo-area-substring,
eldoc-display-in-echo-area): Take invisible text into consideration
when counting lines to crop an echo-area message.
(Version): Bump.
-rw-r--r-- | lisp/emacs-lisp/eldoc.el | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 73713a3dec9..74ffeb166d4 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -5,7 +5,7 @@ ;; Author: Noah Friedman <friedman@splode.com> ;; Keywords: extensions ;; Created: 1995-10-06 -;; Version: 1.11.0 +;; Version: 1.11.1 ;; Package-Requires: ((emacs "26.3")) ;; This is a GNU ELPA :core package. Avoid functionality that is not @@ -102,7 +102,7 @@ put in the echo area. If a positive integer, the number is used directly, while a float specifies the number of lines as a proportion of the echo area frame's height. -If value is the symbol `truncate-sym-name-if-fit' t, the part of +If value is the symbol `truncate-sym-name-if-fit', the part of the doc string that represents a symbol's name may be truncated if it will enable the rest of the doc string to fit on a single line, without resizing the echo area. @@ -525,7 +525,8 @@ Helper for `eldoc-display-in-echo-area'." (goto-char (point-min)) (skip-chars-forward " \t\n") (point)) - (goto-char (line-end-position available)) + (forward-visible-line (1- available)) + (end-of-visible-line) (skip-chars-backward " \t\n"))) (truncated (save-excursion (skip-chars-forward " \t\n") @@ -535,7 +536,8 @@ Helper for `eldoc-display-in-echo-area'." ((and truncated (> available 1) eldoc-echo-area-display-truncation-message) - (goto-char (line-end-position 0)) + (forward-visible-line -1) + (end-of-visible-line) (concat (buffer-substring start (point)) (format "\n(Documentation truncated. Use `%s' to see rest)" @@ -610,7 +612,8 @@ Honor `eldoc-echo-area-use-multiline-p' and (let ((string (with-current-buffer (eldoc--format-doc-buffer docs) (buffer-substring (goto-char (point-min)) - (line-end-position 1))))) + (progn (end-of-visible-line) + (point)))))) (if (> (length string) width) ; truncation to happen (unless (eldoc--echo-area-prefer-doc-buffer-p t) (truncate-string-to-width string width)) |