emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 4821da1ad7f: Fix show-paren-mode when the parentheses is partia


From: Eli Zaretskii
Subject: emacs-29 4821da1ad7f: Fix show-paren-mode when the parentheses is partially visible
Date: Mon, 10 Jul 2023 10:16:55 -0400 (EDT)

branch: emacs-29
commit 4821da1ad7fe0f30cb4d41669ad2db8652fcfa79
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    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)
---
 lisp/paren.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]