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)
This commit is contained in:
Eli Zaretskii 2023-07-10 17:15:21 +03:00
parent 419b4d4491
commit 4821da1ad7

View file

@ -506,7 +506,19 @@ It is the default value of `show-paren-data-function'."
(when (and show-paren-context-when-offscreen (when (and show-paren-context-when-offscreen
(not (eql show-paren--last-pos (point))) (not (eql show-paren--last-pos (point)))
(< there-beg here-beg) (< 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 (let ((context (blink-paren-open-paren-line-string
openparen)) openparen))
(message-log-max nil)) (message-log-max nil))