GNU bug report logs - #22891
25.0.92; set-fringe-mode with left fringe 0 breaks window width calculations on Mac OS (again)

Previous Next

Package: emacs;

Reported by: Constantine Vetoshev <vetoshev <at> gmail.com>

Date: Thu, 3 Mar 2016 06:39:01 UTC

Severity: normal

Found in version 25.0.92

Done: Anders Lindgren <andlind <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22891 in the body.
You can then email your comments to 22891 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Thu, 03 Mar 2016 06:39:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Constantine Vetoshev <vetoshev <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 03 Mar 2016 06:39:01 GMT) Full text and rfc822 format available.

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

From: Constantine Vetoshev <vetoshev <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.92; set-fringe-mode with left fringe 0 breaks window width
 calculations on Mac OS (again)
Date: Wed, 2 Mar 2016 22:38:05 -0800
The Emacs pretest released earlier today has a window width
calculation problem on Mac OS X when the window left fringe is turned
off. This bug seems similar to #18601 and #16470.

To reproduce, do the following:

1. Start Emacs 25.0.92 (with -Q to avoid loading initialization file).
2. Execute this Elisp: (set-fringe-mode '(0 . 7))
3. Execute M-x ansi-term and select /bin/zsh as your shell.
4. Resize the frame to make it slightly wider (I used the mouse to
make the frame one character wider).
5. Run 'ls' in the shell. Notice the spurious % characters printed
everywhere. This is the bug.

Setting the fringe to '(1 . 7) makes the problem go away.

I noticed that the fringe needs to be set wider in Emacs 25 compared
to 24. I used fringe '(0 . 2) in the past, but that's now too small.
It seems that the fringe window width calculation has changed, and
re-introduced this bug.


In GNU Emacs 25.0.92.1 (x86_64-apple-darwin15.3.0, NS appkit-1404.34
Version 10.11.3 (Build 15D21))
 of 2016-03-02 built on athena.local
Windowing system distributor 'Apple', version 10.3.1404
Configured using:
 'configure --with-ns'

Configured features:
NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS

Important settings:
  value of $LC_COLLATE: C
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Term

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
((left-fringe . 0) (right-fringe . 0))
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec epg epg-config gnus-util mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util help-fns help-mode cl-loaddefs pcase cl-lib
mail-prsvr mail-utils term disp-table easymenu ehelp ring time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel ns-win ucs-normalize term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame
cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote kqueue cocoa ns
multi-tty make-network-process emacs)

Memory information:
((conses 16 199926 9804)
 (symbols 48 19902 0)
 (miscs 40 63 188)
 (strings 32 16034 4798)
 (string-bytes 1 462558)
 (vectors 16 33606)
 (vector-slots 8 650873 6522)
 (floats 8 162 177)
 (intervals 56 293 0)
 (buffers 976 13))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Mon, 11 Apr 2016 06:59:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Constantine Vetoshev <vetoshev <at> gmail.com>, 22891 <at> debbugs.gnu.org
Subject: Re: bug#22891: 25.0.92; set-fringe-mode with left fringe 0 breaks
 window width calculations on Mac OS (again)
Date: Mon, 11 Apr 2016 08:58:07 +0200
> The Emacs pretest released earlier today has a window width
> calculation problem on Mac OS X when the window left fringe is turned
> off. This bug seems similar to #18601 and #16470.
>
> To reproduce, do the following:
>
> 1. Start Emacs 25.0.92 (with -Q to avoid loading initialization file).
> 2. Execute this Elisp: (set-fringe-mode '(0 . 7))
> 3. Execute M-x ansi-term and select /bin/zsh as your shell.
> 4. Resize the frame to make it slightly wider (I used the mouse to
> make the frame one character wider).
> 5. Run 'ls' in the shell. Notice the spurious % characters printed
> everywhere. This is the bug.
>
> Setting the fringe to '(1 . 7) makes the problem go away.
>
> I noticed that the fringe needs to be set wider in Emacs 25 compared
> to 24. I used fringe '(0 . 2) in the past, but that's now too small.
> It seems that the fringe window width calculation has changed, and
> re-introduced this bug.
>
>
> In GNU Emacs 25.0.92.1 (x86_64-apple-darwin15.3.0, NS appkit-1404.34
> Version 10.11.3 (Build 15D21))
>   of 2016-03-02 built on athena.local

Sorry, this mail ended up in the wrong folder so it went by unnoticed
for such long time.  I have no idea which change could have caused this.
Could you please try to bisect to find the offending commit?

Thanks, martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Thu, 14 Apr 2016 05:34:02 GMT) Full text and rfc822 format available.

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

From: Anders Lindgren <andlind <at> gmail.com>
To: 22891 <at> debbugs.gnu.org, martin rudalics <rudalics <at> gmx.at>
Subject: 25.0.92; set-fringe-mode with left fringe 0 breaks window width
 calculations on Mac OS (again)
Date: Thu, 14 Apr 2016 07:33:15 +0200
[Message part 1 (text/plain, inline)]
Hi!

I took a look at this from the NS port point of view.

Setting the `left-frame' frame parameter to any from 1 and up change the
width of the fringe, while retaining the width of the text area (80
characters). However, setting it to 0 makes the text area wrap on 79
characters (despite there being space for the 80:th character) while
`window-width' still returns 80.

Presumably, this is the root cause of the ansi-term problem.

However, to check if this was a NS specific problem, I tested this on a
freshly built GTK+ emacs on LinuxMint. It turned out that it, too, suffers
from the same problem, so I'm handing over this to you, Martin.

Steps to repeat:

   emacs -Q
   C-u 8 0 x RET
        ;; This inserts a line wide enough to reach the right side of the
screen without wrapping)
   (set-frame-parameter (selected-frame) 'left-fringe 50)
        ;; This makes the left fringe wide, the text area still holds the
80 x:s nicely.
   (window-width)
        ;; 80
   (set-frame-parameter (selected-frame) 'left-fringe 1)
        ;; Narrow left fringe. Text area still holds the x:s
   (window-width)
        ;; 80
   (set-frame-parameter (selected-frame) 'left-fringe 0)
        ;; The line of x:s wrap
   (window-width)
        ;; 80 -- inconsistent with what is displayed on screen.

    -- Anders
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Thu, 14 Apr 2016 15:19:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Anders Lindgren <andlind <at> gmail.com>
Cc: 22891 <at> debbugs.gnu.org, rudalics <at> gmx.at
Subject: Re: bug#22891: 25.0.92;
 set-fringe-mode with left fringe 0 breaks window width calculations
 on Mac OS (again)
Date: Thu, 14 Apr 2016 18:17:49 +0300
> Date: Thu, 14 Apr 2016 07:33:15 +0200
> From: Anders Lindgren <andlind <at> gmail.com>
> 
> Setting the `left-frame' frame parameter to any from 1 and up change the width of the fringe, while retaining
> the width of the text area (80 characters). However, setting it to 0 makes the text area wrap on 79 characters
> (despite there being space for the 80:th character) while `window-width' still returns 80.

This is all as expected: setting any of the fringes to zero requires
displaying a continuation glyph in the text area, and since Emacs
supports bidirectional display, we need to usurp one character cell
from the other edge of the window as well, to make the geometry of L2R
and R2L screen lines symmetrical.

> Presumably, this is the root cause of the ansi-term problem.

If this causes trouble in ansi-term, then ansi-term should be fixed to
take this into consideration.  (Presumably, ansi-term uses wrong
interfaces to get at the width of the text area.)

> However, to check if this was a NS specific problem, I tested this on a freshly built GTK+ emacs on
> LinuxMint. It turned out that it, too, suffers from the same problem, so I'm handing over this to you, Martin.

This is not Martin's problem, this is a problem in ansi-term (AFAIU).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Thu, 14 Apr 2016 18:20:02 GMT) Full text and rfc822 format available.

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

From: Anders Lindgren <andlind <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 22891 <at> debbugs.gnu.org, martin rudalics <rudalics <at> gmx.at>
Subject: Re: bug#22891: 25.0.92; set-fringe-mode with left fringe 0 breaks
 window width calculations on Mac OS (again)
Date: Thu, 14 Apr 2016 20:19:36 +0200
[Message part 1 (text/plain, inline)]
Hi!


> > Setting the `left-frame' frame parameter to any from 1 and up change the
> width of the fringe, while retaining
> > the width of the text area (80 characters). However, setting it to 0
> makes the text area wrap on 79 characters
> > (despite there being space for the 80:th character) while `window-width'
> still returns 80.
>
> This is all as expected: setting any of the fringes to zero requires
> displaying a continuation glyph in the text area, and since Emacs
> supports bidirectional display, we need to usurp one character cell
> from the other edge of the window as well, to make the geometry of L2R
> and R2L screen lines symmetrical.
>

Oh, this was a bit unexpected...

However, I don't understand why you need it. If the right fringe is
visible, it can hold the continuation character. In fact, I just tried this
with the left fringe set to 0 with a bidirectional text stretching multiple
lines, and the last text column didn't appear to be used at all.

Furthermore, I don't think this is what people want -- some people would
surely like to hide the fringes (especially the left) without losing one
text column. (Most Emacs users don't use bidirectional text anyway.)

When it comes to documentation, there is very little, if any, information
about this. For example, this is the description of the fringe frame
properties, it doesn't mention that setting either to zero would make Emacs
reserve a column for the continuation glyph:

    `left-fringe'
    `right-fringe'
         The default width of the left and right fringes of windows in this
         frame (*note Fringes::).  If either of these is zero, that
         effectively removes the corresponding fringe.

In the documentation of `window-width' (a.k.a. `window-body-width') it is
mentioned that the width includes the continuation glyph. However, in
`window-text-width' it is not.

It took some time to find the function `window-max-chars-per-line', which
seems to be the only way to check if there is a column reserved for the
continuation character. (term.el has replicated the logic in
`term-window-width'.)


Anyway, I think I found the real problem this time. ansi-term picks the
window size from both `term-window-width' (which correctly returns 79) and
`window-adjust-process-window-size-smallest' which doesn't take the
continuation glyph into account and says that the width is 80.

Again, I'l leaving it to others to fix it, as this is code I'm not at all
familiar with.

    -- Anders
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Thu, 14 Apr 2016 19:26:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Anders Lindgren <andlind <at> gmail.com>
Cc: 22891 <at> debbugs.gnu.org, rudalics <at> gmx.at
Subject: Re: bug#22891: 25.0.92; set-fringe-mode with left fringe 0 breaks
 window width calculations on Mac OS (again)
Date: Thu, 14 Apr 2016 22:24:58 +0300
> Date: Thu, 14 Apr 2016 20:19:36 +0200
> From: Anders Lindgren <andlind <at> gmail.com>
> Cc: 22891 <at> debbugs.gnu.org, martin rudalics <rudalics <at> gmx.at>
> 
> However, I don't understand why you need it. If the right fringe is visible, it can hold the continuation character.

R2L lines display the continuation glyph on the left.

> In fact, I just tried this with the left fringe set to 0 with a bidirectional text stretching multiple lines, and the last
> text column didn't appear to be used at all.

Sorry, I don't understand what you tried.  Please show a screenshot.

> Furthermore, I don't think this is what people want -- some people would surely like to hide the fringes
> (especially the left) without losing one text column. (Most Emacs users don't use bidirectional text anyway.)

They should set the fringes to 1-pixel width, then.  Or make their
frames 1 character wider.  Sorry, I simply didn't find any other
reasonable way to make the display code sane and the results on the
screen plausible.  Breaking bidirectional display is a no-starter
nowadays, I certainly won't agree to that.  Motivated volunteers are
welcome to find a better solution.

(Once upon a time, Emacs couldn't display continuation glyphs on GUI
frames at all, until someone convinced me to add this feature.  The
rest is history.)

> When it comes to documentation, there is very little, if any, information about this.

Suggestions for how and where to document this, and patches to that
effect, are welcome.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Fri, 15 Apr 2016 01:25:01 GMT) Full text and rfc822 format available.

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

From: Constantine Vetoshev <vetoshev <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 22891 <at> debbugs.gnu.org
Subject: Re: bug#22891: 25.0.92; set-fringe-mode with left fringe 0 breaks
 window width calculations on Mac OS (again)
Date: Thu, 14 Apr 2016 18:24:16 -0700
On Sun, Apr 10, 2016 at 11:58 PM, martin rudalics <rudalics <at> gmx.at> wrote:
> Could you please try to bisect to find the offending commit?

Yes, of course. It seems to have been commit 165bea78. Please let me
know if I can help further.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Fri, 15 Apr 2016 07:12:02 GMT) Full text and rfc822 format available.

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

From: Anders Lindgren <andlind <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 22891 <at> debbugs.gnu.org, martin rudalics <rudalics <at> gmx.at>
Subject: Re: bug#22891: 25.0.92; set-fringe-mode with left fringe 0 breaks
 window width calculations on Mac OS (again)
Date: Fri, 15 Apr 2016 09:11:12 +0200
[Message part 1 (text/plain, inline)]
>
> > However, I don't understand why you need it. If the right fringe is
> visible, it can hold the continuation character.
>
> R2L lines display the continuation glyph on the left.
>
> > In fact, I just tried this with the left fringe set to 0 with a
> bidirectional text stretching multiple lines, and the last
> > text column didn't appear to be used at all.
>
> Sorry, I don't understand what you tried.  Please show a screenshot.
>

I've attached a screenshot where I've:

    C-u 80 x        ;; To get a reference 80 character line
    Copied bidirectional text from http://www.i18nguy.com/unicode/shma.html
    (set-frame-parameter (selected-frame) 'left-fringe 0)

Here, I only see continuation marks in the right fringe only. The column
reserved for the continuation glyph isn't used at all, neither to the left
or to the right, despite the text being wrapped.

As far as I can tell, it's the same on the NS port and when using GTK.



Also, I noticed that `window-max-chars-per-line' does not take into account
the variable `left-frame-width' (and presumably `right-frame-width').

    emacs -Q
    C-u 81 x
    (setq left-fringe-width 0)
    ;; This doesn't take effect immediately, temporary display another
buffer.
    C-x b RET
    C-x b RET
    ;; Now, the line with 81 x:s wrap.
    (window-max-chars-per-line)
    ;; Now, this function return 81, which is inconsistent with the display.


In the short term, I would like to see a function like
`(continuation-glyph-visible-p WIN)' which could be used by functions like
`window-max-chars-per-line' to get the logic correct without having to
resort to replicate the details of the display engine (which, apparently,
is non-trivial).

In the long term, it would be great to have a `continuation-glyph-visible'
frame property and corresponding buffer-local variable. That way a user
could decide the layout for themselves.



Back to the original question. I think the following patch solve the
ansi-term problem. In addition, I would suggest that we retire
`term-window-width' if favour of `window-max-chars-per-line', so that the
complex logic needed to determine if there is a continuation character only
is in one place.

diff --git a/lisp/window.el b/lisp/window.el
index 7e46aa8..371fcab 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8485,10 +8485,10 @@ window-adjust-process-window-size
 a two-argument function used to combine the widths and heights of
 the given windows."
   (when windows
-    (let ((width (window-body-width (car windows)))
+    (let ((width (window-max-chars-per-line (car windows)))
           (height (window-body-height (car windows))))
       (dolist (window (cdr windows))
-        (setf width (funcall reducer width (window-body-width window)))
+        (setf width (funcall reducer width (window-max-chars-per-line
window)))
         (setf height (funcall reducer height (window-body-height window))))
       (cons width height))))

Sincerely,
    Anders
[Message part 2 (text/html, inline)]
[Screen Shot 2016-04-15 at 6.35.59 .png (image/png, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Fri, 15 Apr 2016 07:44:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Anders Lindgren <andlind <at> gmail.com>
Cc: 22891 <at> debbugs.gnu.org, rudalics <at> gmx.at
Subject: Re: bug#22891: 25.0.92; set-fringe-mode with left fringe 0 breaks
 window width calculations on Mac OS (again)
Date: Fri, 15 Apr 2016 10:42:48 +0300
> Date: Fri, 15 Apr 2016 09:11:12 +0200
> From: Anders Lindgren <andlind <at> gmail.com>
> Cc: 22891 <at> debbugs.gnu.org, martin rudalics <rudalics <at> gmx.at>
> 
>  R2L lines display the continuation glyph on the left.
> 
>  > In fact, I just tried this with the left fringe set to 0 with a bidirectional text stretching multiple lines, and
>  the last
>  > text column didn't appear to be used at all.
> 
>  Sorry, I don't understand what you tried. Please show a screenshot.
> 
> I've attached a screenshot where I've:

You did that in *scratch*, which forces all lines to be L2R (because
its major mode is Emacs Lisp, a programming language mode).  See the
value of bidi-paragraph-direction in that buffer.  So all of your
lines are L2R, they just display text in R2L script.

To see what I meant, create a new buffer with "C-x b", then paste the
same text there, after setting the left fringe width to zero.

> Also, I noticed that `window-max-chars-per-line' does not take into account the variable `left-frame-width' (and
> presumably `right-frame-width').

You mean left-fringe-width, I presume?  Yes, that's probably a bug.

> In the short term, I would like to see a function like `(continuation-glyph-visible-p WIN)' which could be used by
> functions like `window-max-chars-per-line' to get the logic correct without having to resort to replicate the
> details of the display engine (which, apparently, is non-trivial).
> 
> In the long term, it would be great to have a `continuation-glyph-visible' frame property and corresponding
> buffer-local variable. That way a user could decide the layout for themselves.

Why is this useful, when we already have window-max-chars-per-line?
IOW, when would you like to know about the continuation glyph, and not
about how many characters can be displayed on a line?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Fri, 15 Apr 2016 08:06:02 GMT) Full text and rfc822 format available.

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

From: Anders Lindgren <andlind <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 22891 <at> debbugs.gnu.org, martin rudalics <rudalics <at> gmx.at>
Subject: Re: bug#22891: 25.0.92; set-fringe-mode with left fringe 0 breaks
 window width calculations on Mac OS (again)
Date: Fri, 15 Apr 2016 10:05:19 +0200
[Message part 1 (text/plain, inline)]
Hi!

To see what I meant, create a new buffer with "C-x b", then paste the
> same text there, after setting the left fringe width to zero.
>

Yes, now I see it. (However, the continuation characters disappeared when
L2R text was entered on the line before the R2L text.)


> Also, I noticed that `window-max-chars-per-line' does not take into
> account the variable `left-frame-width' (and
> > presumably `right-frame-width').
>
> You mean left-fringe-width, I presume?  Yes, that's probably a bug.
>

Yes, I mean `left-fringe-width'.



> Why is this useful, when we already have window-max-chars-per-line?
> IOW, when would you like to know about the continuation glyph, and not
> about how many characters can be displayed on a line?
>

I intended it as a way to implement `window-max-chars-per-line' in a more
robust way than today.

In addition, I can think of a use case. If you want to create a window of a
specific width, excluding the continuation glyph, this can be used:

   (split-window-right (if (continuation-glyph-visible-p (selected-window))
                                  (+ width 1)
                                width))

    -- Anders
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Fri, 15 Apr 2016 08:27:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Anders Lindgren <andlind <at> gmail.com>
Cc: 22891 <at> debbugs.gnu.org, rudalics <at> gmx.at
Subject: Re: bug#22891: 25.0.92; set-fringe-mode with left fringe 0 breaks
 window width calculations on Mac OS (again)
Date: Fri, 15 Apr 2016 11:25:48 +0300
> Date: Fri, 15 Apr 2016 10:05:19 +0200
> From: Anders Lindgren <andlind <at> gmail.com>
> Cc: 22891 <at> debbugs.gnu.org, martin rudalics <rudalics <at> gmx.at>
> 
>  To see what I meant, create a new buffer with "C-x b", then paste the
>  same text there, after setting the left fringe width to zero.
> 
> Yes, now I see it. (However, the continuation characters disappeared when L2R text was entered on the line
> before the R2L text.)

If there was no empty line between the L2R and the R2L lines, then
inserting that L2R line made the entire paragraph be L2R, and you are
back at what happened in *scratch*.  (How Emacs determines the base
paragraph direction is documented in the Emacs User manual, in the
node "Bidirectional Editing".)

> In addition, I can think of a use case. If you want to create a window of a specific width, excluding the
> continuation glyph, this can be used:
> 
> (split-window-right (if (continuation-glyph-visible-p (selected-window))

You can implement this using window-max-chars-per-line.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Wed, 20 Apr 2016 13:49:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Constantine Vetoshev <vetoshev <at> gmail.com>, 
 Daniel Colascione <dancol <at> dancol.org>
Cc: 22891 <at> debbugs.gnu.org, Daniel Colascione <dan.colascione <at> gmail.com>
Subject: Re: bug#22891: 25.0.92; set-fringe-mode with left fringe 0 breaks
 window width calculations on Mac OS (again)
Date: Wed, 20 Apr 2016 15:48:20 +0200
>> Could you please try to bisect to find the offending commit?
>
> Yes, of course. It seems to have been commit 165bea78. Please let me
> know if I can help further.

Thank you.  Let's see whether Daniel can help us (he'll get two mails
from me ;-))

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Sat, 23 Apr 2016 18:43:01 GMT) Full text and rfc822 format available.

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

From: Anders Lindgren <andlind <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>,
 Constantine Vetoshev <vetoshev <at> gmail.com>, 22891 <at> debbugs.gnu.org
Cc: Daniel Colascione <dancol <at> dancol.org>
Date: Sat, 23 Apr 2016 20:42:30 +0200
[Message part 1 (text/plain, inline)]
Hi!

I think that I already have solved this, but awaiting confirmation I
haven't committed the change. In short, when either fringe is zero, Emacs
reserves one column for a terminal-style continuation character. The
function `window-adjust-process-window-size' in window.el should use
`window-max-chars-per-line' rather than `window-body-width' to take the
continuation character into consideration.

See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22891#26 for details.

In that message I also suggested removing `term-window-width' and instead
use `window-max-chars-per-line', as both functions use a complex algorithm
to determine whether or not a column is reserved for the continuation
character. Well, since I wrote the suggestion, a bug was found and fixed in
`window-max-chars-per-line' while the bug still remains in
`term-window-width'...

    -- Anders
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Sat, 23 Apr 2016 19:04:02 GMT) Full text and rfc822 format available.

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

From: Daniel Colascione <dancol <at> dancol.org>
To: Anders Lindgren <andlind <at> gmail.com>, martin rudalics <rudalics <at> gmx.at>,
 Constantine Vetoshev <vetoshev <at> gmail.com>, 22891 <at> debbugs.gnu.org
Subject: Re:
Date: Sat, 23 Apr 2016 12:03:31 -0700
[Message part 1 (text/plain, inline)]
On 04/23/2016 11:42 AM, Anders Lindgren wrote:
> Hi!
> 
> I think that I already have solved this, but awaiting confirmation I
> haven't committed the change. In short, when either fringe is zero,
> Emacs reserves one column for a terminal-style continuation character.
> The function `window-adjust-process-window-size' in window.el should use
> `window-max-chars-per-line' rather than `window-body-width' to take the
> continuation character into consideration.
> 
> See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22891#26 for details.
> 
> In that message I also suggested removing `term-window-width' and
> instead use `window-max-chars-per-line', as both functions use a complex
> algorithm to determine whether or not a column is reserved for the
> continuation character. Well, since I wrote the suggestion, a bug was
> found and fixed in `window-max-chars-per-line' while the bug still
> remains in `term-window-width'...

Sounds good to me.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Sun, 24 Apr 2016 08:42:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Anders Lindgren <andlind <at> gmail.com>, 
 Constantine Vetoshev <vetoshev <at> gmail.com>, 22891 <at> debbugs.gnu.org
Cc: Daniel Colascione <dancol <at> dancol.org>
Subject: Re:
Date: Sun, 24 Apr 2016 10:40:45 +0200
> I think that I already have solved this, but awaiting confirmation I
> haven't committed the change.

Please either post a patch or install your changes.  From my experience,
Constantine very reliably confirms whether it will work or not.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Sun, 24 Apr 2016 13:05:02 GMT) Full text and rfc822 format available.

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

From: Anders Lindgren <andlind <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 22891 <at> debbugs.gnu.org, Daniel Colascione <dancol <at> dancol.org>,
 Constantine Vetoshev <vetoshev <at> gmail.com>
Subject: Re:
Date: Sun, 24 Apr 2016 15:04:41 +0200
[Message part 1 (text/plain, inline)]
>
> Please either post a patch or install your changes.  From my experience,
> Constantine very reliably confirms whether it will work or not.


Message #26 contains a patch that fix the problem.

    -- Anders
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Sun, 24 Apr 2016 19:08:01 GMT) Full text and rfc822 format available.

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

From: Anders Lindgren <andlind <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 22891 <at> debbugs.gnu.org, Daniel Colascione <dancol <at> dancol.org>,
 Constantine Vetoshev <vetoshev <at> gmail.com>
Subject: Re:
Date: Sun, 24 Apr 2016 21:07:08 +0200
[Message part 1 (text/plain, inline)]
Hi!

Here comes a new patch with both changes. Unless anybody complains, I will
push it to "master".

Just a little concern: I just took a look at the Emacs lisp directory. I
estimate is that a majority (but no all) of calls to `window-width',
`window-text-width', and `window-body-width' really should be to
`window-max-chars-per-line'.

    -- Anders


On Sun, Apr 24, 2016 at 10:40 AM, martin rudalics <rudalics <at> gmx.at> wrote:

> > I think that I already have solved this, but awaiting confirmation I
> > haven't committed the change.
>
> Please either post a patch or install your changes.  From my experience,
> Constantine very reliably confirms whether it will work or not.
>
> martin
>
[Message part 2 (text/html, inline)]
[term.diff (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Tue, 26 Apr 2016 06:35:01 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Anders Lindgren <andlind <at> gmail.com>
Cc: 22891 <at> debbugs.gnu.org, Daniel Colascione <dancol <at> dancol.org>,
 Constantine Vetoshev <vetoshev <at> gmail.com>
Subject: Re:
Date: Tue, 26 Apr 2016 08:34:23 +0200
> Here comes a new patch with both changes. Unless anybody complains, I will
> push it to "master".

The fix for bug#22891 should go into emacs-25.  Otherwise, we release code
that worked for emacs 24.5.

> Just a little concern: I just took a look at the Emacs lisp directory. I
> estimate is that a majority (but no all) of calls to `window-width',
> `window-text-width', and `window-body-width' really should be to
> `window-max-chars-per-line'.

These should be probably fixed on master.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Tue, 26 Apr 2016 06:45:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 22891 <at> debbugs.gnu.org, vetoshev <at> gmail.com, andlind <at> gmail.com
Subject: Re: bug#22891:
Date: Tue, 26 Apr 2016 09:44:15 +0300
> Date: Tue, 26 Apr 2016 08:34:23 +0200
> From: martin rudalics <rudalics <at> gmx.at>
> Cc: 22891 <at> debbugs.gnu.org, Constantine Vetoshev <vetoshev <at> gmail.com>
> 
>  > Here comes a new patch with both changes. Unless anybody complains, I will
>  > push it to "master".
> 
> The fix for bug#22891 should go into emacs-25.  Otherwise, we release code
> that worked for emacs 24.5.

I agree.

>  > Just a little concern: I just took a look at the Emacs lisp directory. I
>  > estimate is that a majority (but no all) of calls to `window-width',
>  > `window-text-width', and `window-body-width' really should be to
>  > `window-max-chars-per-line'.
> 
> These should be probably fixed on master.

Yes; and I'd prefer to see this discussed first, as I'm not so sure
the conclusion is correct.  This is a tricky issue; in particular, the
units in which window-max-chars-per-line measures are different from
those of the other functions, so the question is how the result is
being used, not just whether the character cell reserved for
continuation and truncation glyphs counts.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Tue, 26 Apr 2016 19:05:02 GMT) Full text and rfc822 format available.

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

From: Constantine Vetoshev <vetoshev <at> gmail.com>
To: Anders Lindgren <andlind <at> gmail.com>
Cc: martin rudalics <rudalics <at> gmx.at>, Daniel Colascione <dancol <at> dancol.org>,
 22891 <at> debbugs.gnu.org
Subject: Re:
Date: Tue, 26 Apr 2016 12:03:36 -0700
On Sun, Apr 24, 2016 at 12:07 PM, Anders Lindgren <andlind <at> gmail.com> wrote:
> Here comes a new patch with both changes. Unless anybody complains, I will
> push it to "master".

I applied this patch to the emacs-25 branch (as of commit ccb75d7),
and it works. Thank you!

PS: Sorry I didn't get a chance to test and reply earlier; I was away
this past weekend.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Tue, 26 Apr 2016 19:12:02 GMT) Full text and rfc822 format available.

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

From: Anders Lindgren <andlind <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 22891 <at> debbugs.gnu.org, Daniel Colascione <dancol <at> dancol.org>,
 Constantine Vetoshev <vetoshev <at> gmail.com>
Subject: Re:
Date: Tue, 26 Apr 2016 21:10:58 +0200
[Message part 1 (text/plain, inline)]
Hi!

> Here comes a new patch with both changes. Unless anybody complains, I will
> > push it to "master".
>
> The fix for bug#22891 should go into emacs-25.  Otherwise, we release code
> that worked for emacs 24.5.



I just pushed this to master. See
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=5b5403289888efe8783ae6a405845b925f544ec1
for details.

If you think this is important enough to go into emacs-25, please merge it
to that branch as well.


> Just a little concern: I just took a look at the Emacs lisp directory. I
> > estimate is that a majority (but no all) of calls to `window-width',
> > `window-text-width', and `window-body-width' really should be to
> > `window-max-chars-per-line'.
>
> These should be probably fixed on master.


I agree to 100% -- it will require quite an effort as someone will have to
look at each instance and check if the continuation glyph should be
included or not. (That "someone" won't be me, though.)


Constantine Vetoshev:

>  applied this patch to the emacs-25 branch (as of commit ccb75d7),
and it works. Thank you!

Thanks for testing and confirming!

    -- Anders
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Tue, 26 Apr 2016 19:18:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Anders Lindgren <andlind <at> gmail.com>
Cc: rudalics <at> gmx.at, vetoshev <at> gmail.com, 22891 <at> debbugs.gnu.org
Subject: Re: bug#22891:
Date: Tue, 26 Apr 2016 22:17:14 +0300
> Date: Tue, 26 Apr 2016 21:10:58 +0200
> From: Anders Lindgren <andlind <at> gmail.com>
> Cc: 22891 <at> debbugs.gnu.org, Constantine Vetoshev <vetoshev <at> gmail.com>
> 
>  The fix for bug#22891 should go into emacs-25. Otherwise, we release code
>  that worked for emacs 24.5.
> 
> I just pushed this to master. See
> http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=5b5403289888efe8783ae6a405845b925f544ec1 for
> details.
> 
> If you think this is important enough to go into emacs-25, please merge it to that branch as well.

Cherry-pick, not merge.  With a "backport" in the log message, please.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Tue, 26 Apr 2016 21:08:01 GMT) Full text and rfc822 format available.

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

From: Anders Lindgren <andlind <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: martin rudalics <rudalics <at> gmx.at>,
 Constantine Vetoshev <vetoshev <at> gmail.com>, 22891 <at> debbugs.gnu.org
Subject: Re: bug#22891:
Date: Tue, 26 Apr 2016 23:07:20 +0200
[Message part 1 (text/plain, inline)]
>
> Cherry-pick, not merge.  With a "backport" in the log message, please.
>

Unfortunately, I'm new to git, so I have to read up on how to do that.

    -- Anders
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Wed, 27 Apr 2016 06:22:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Anders Lindgren <andlind <at> gmail.com>
Cc: rudalics <at> gmx.at, vetoshev <at> gmail.com, 22891 <at> debbugs.gnu.org
Subject: Re: bug#22891:
Date: Wed, 27 Apr 2016 09:21:17 +0300
> Date: Tue, 26 Apr 2016 23:07:20 +0200
> From: Anders Lindgren <andlind <at> gmail.com>
> Cc: martin rudalics <rudalics <at> gmx.at>, 22891 <at> debbugs.gnu.org, 
> 	Constantine Vetoshev <vetoshev <at> gmail.com>
> 
>  Cherry-pick, not merge. With a "backport" in the log message, please.
> 
> Unfortunately, I'm new to git, so I have to read up on how to do that.

In a nutshell, do the following in the emacs-25 branch's checkout:

   git cherry-pick -x SHA1 -e

where SHA1 is the hash of the commit you want to cherry-pick.  The -e
switch will let you edit the commit message, which is needed for
adding the "backport" thing.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Wed, 27 Apr 2016 21:31:01 GMT) Full text and rfc822 format available.

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

From: Anders Lindgren <andlind <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: martin rudalics <rudalics <at> gmx.at>,
 Constantine Vetoshev <vetoshev <at> gmail.com>, 22891 <at> debbugs.gnu.org
Subject: Re: bug#22891:
Date: Wed, 27 Apr 2016 23:30:37 +0200
[Message part 1 (text/plain, inline)]
Hi!


> In a nutshell, do the following in the emacs-25 branch's checkout:
>
>    git cherry-pick -x SHA1 -e
>
> where SHA1 is the hash of the commit you want to cherry-pick.  The -e
> switch will let you edit the commit message, which is needed for
> adding the "backport" thing.
>

Done!

Thanks for your support!

    -- Anders
[Message part 2 (text/html, inline)]

Reply sent to Anders Lindgren <andlind <at> gmail.com>:
You have taken responsibility. (Wed, 27 Apr 2016 21:39:02 GMT) Full text and rfc822 format available.

Notification sent to Constantine Vetoshev <vetoshev <at> gmail.com>:
bug acknowledged by developer. (Wed, 27 Apr 2016 21:39:02 GMT) Full text and rfc822 format available.

Message #82 received at 22891-done <at> debbugs.gnu.org (full text, mbox):

From: Anders Lindgren <andlind <at> gmail.com>
To: 22891-done <at> debbugs.gnu.org
Subject: Fixed: 25.0.92; set-fringe-mode with left fringe 0 breaks window
 width calculations on Mac OS (again)
Date: Wed, 27 Apr 2016 23:38:16 +0200
[Message part 1 (text/plain, inline)]
This problem has been fixed and published on "master" and backported to
"emacs-25" (after being approved by Eli).

In the end it was not related to OS X. Instead, it was a function in
window.el used to by terminal windows to track the window width that didn't
take the continuation glyph into account. (The continuation glyph is
visible when the width of a fringe is zero.)

See the following for details:

http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=5b5403289888efe8783ae6a405845b925f544ec1

http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-25&id=ff7e201ed87d206334afedd4366deebba440efde

    -- Anders
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22891; Package emacs. (Thu, 28 Apr 2016 06:34:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Anders Lindgren <andlind <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 22891 <at> debbugs.gnu.org, Constantine Vetoshev <vetoshev <at> gmail.com>
Subject: Re: bug#22891:
Date: Thu, 28 Apr 2016 08:33:22 +0200
> Thanks for your support!

Thanks for the fix!

martin





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 26 May 2016 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 85 days ago.

Previous Next


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