GNU bug report logs - #59963
29.0.50; 'window-max-chars-per-line' doesn't always work on GUI without fringe

Previous Next

Package: emacs;

Reported by: Akib Azmain Turja <akib <at> disroot.org>

Date: Sun, 11 Dec 2022 12:32:02 UTC

Severity: normal

Found in version 29.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #32 received at 59963 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: akib <at> disroot.org
Cc: rudalics <at> gmx.at, 59963 <at> debbugs.gnu.org
Subject: Re: bug#59963: 29.0.50;
 'window-max-chars-per-line' doesn't always work on GUI without fringe
Date: Wed, 14 Dec 2022 17:21:33 +0200
Akib, please see if the patch below gives good results, including in
the real-life use case which triggered this report:

diff --git a/lisp/window.el b/lisp/window.el
index 7d8ee48..a4a8421 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2162,17 +2162,14 @@ window-max-chars-per-line
     (let* ((window-width (window-body-width window t))
 	   (font-width (window-font-width window face))
 	   (ncols (- (/ window-width font-width)
-                     (ceiling (line-number-display-width 'columns)))))
+                     (ceiling (line-number-display-width 'columns))))
+           (fringes (window-fringes window))
+           (lfringe (car fringes))
+           (rfringe (nth 1 fringes)))
       (if (and (display-graphic-p)
 	       overflow-newline-into-fringe
-               (not
-                (or (eq left-fringe-width 0)
-                    (and (null left-fringe-width)
-                         (= (frame-parameter nil 'left-fringe) 0))))
-               (not
-                (or (eq right-fringe-width 0)
-                    (and (null right-fringe-width)
-                         (= (frame-parameter nil 'right-fringe) 0)))))
+               (not (eq lfringe 0))
+               (not (eq rfringe 0)))
 	  ncols
         ;; FIXME: This should remove 1 more column when there are no
         ;; fringes, lines are truncated, and the window is hscrolled,




This bug report was last modified 2 years and 239 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.