diff options
author | Eli Zaretskii <eliz@gnu.org> | 2023-07-10 17:15:21 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2023-07-10 17:15:21 +0300 |
commit | 4821da1ad7fe0f30cb4d41669ad2db8652fcfa79 (patch) | |
tree | 04253092b2678aa76d9a5b0705c01f649c38e59f /lisp | |
parent | 419b4d44914701cedf308df58c3e5789715c87e7 (diff) | |
download | emacs-4821da1ad7fe0f30cb4d41669ad2db8652fcfa79.tar.gz |
Fix show-paren-mode when the parentheses is partially visible
* lisp/paren.el (show-paren-function): Support the case where the
open paren is partially visible, but enough so to not consider it
"off-screen". (Bug#64547)
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/paren.el | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/paren.el b/lisp/paren.el index 4c91fd29490..54a2c23f17f 100644 --- a/lisp/paren.el +++ b/lisp/paren.el @@ -506,7 +506,19 @@ It is the default value of `show-paren-data-function'." (when (and show-paren-context-when-offscreen (not (eql show-paren--last-pos (point))) (< there-beg here-beg) - (not (pos-visible-in-window-p openparen))) + ;; Either OPENPAREN position is fully visible... + (not (or (pos-visible-in-window-p openparen) + (let ((dfh4 (* 0.25 (default-font-height))) + (part + (pos-visible-in-window-p openparen + nil t))) + ;; ...or partially visible, and the + ;; invisible part is less than 1/4th + ;; of the default font height + (or (< (length part) 4) + (and + (< (nth 2 part) dfh4) + (< (nth 3 part) dfh4))))))) (let ((context (blink-paren-open-paren-line-string openparen)) (message-log-max nil)) |