bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#22891: 25.0.92; set-fringe-mode with left fringe 0 breaks window wid


From: Anders Lindgren
Subject: 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

> 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

Attachment: Screen Shot 2016-04-15 at 6.35.59 .png
Description: PNG image


reply via email to

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