emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/page-break-lines 4e5034de4b 43/80: Adjust the length accor


From: ELPA Syncer
Subject: [nongnu] elpa/page-break-lines 4e5034de4b 43/80: Adjust the length according to the width of page-break-lines-char
Date: Tue, 5 Sep 2023 04:03:06 -0400 (EDT)

branch: elpa/page-break-lines
commit 4e5034de4b6fe3cb37a7ab160636054d33cb3dff
Author: Akinori MUSHA <knu@idaemons.org>
Commit: Akinori MUSHA <knu@idaemons.org>

    Adjust the length according to the width of page-break-lines-char
    
    When page-break-lines-char is a wide character, each page break turns to
    two lines.  Unfortunately this is the case for the default value
    (U+2500) in the East-Asian (CJK) language environments, because the
    charater is rendered as wide character there.
    
    cf. [UAX #11: East Asian Width](http://unicode.org/reports/tr11/)
---
 page-break-lines.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/page-break-lines.el b/page-break-lines.el
index f80a9e42b2..91ff51879a 100644
--- a/page-break-lines.el
+++ b/page-break-lines.el
@@ -119,7 +119,11 @@ its display table will be modified as necessary."
             (setq buffer-display-table (make-display-table)))
           (let ((default-height (face-attribute 'default :height nil 
'default)))
             (set-face-attribute 'page-break-lines nil :height default-height)
-            (let* ((width (- (window-width window) 1))
+            (let* ((cwidth (char-width page-break-lines-char))
+                   (wwidth (window-width window))
+                   (width (if (zerop (% wwidth cwidth))
+                              (1- (/ wwidth cwidth))
+                            (/ wwidth cwidth)))
                    (glyph (make-glyph-code page-break-lines-char 
'page-break-lines))
                    (new-display-entry (vconcat (make-list width glyph))))
               (unless (equal new-display-entry (elt buffer-display-table ?\^L))



reply via email to

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