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

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

bug#27525: 25.1; Line wrapping of bidi paragraphs


From: Eli Zaretskii
Subject: bug#27525: 25.1; Line wrapping of bidi paragraphs
Date: Fri, 21 Jul 2017 16:19:35 +0300

> From: Itai Berli <itai.berli@gmail.com>
> Date: Fri, 21 Jul 2017 13:58:57 +0300
> 
> Instead of requiring Emacs to wrap lines correctly as they are being typed, 
> only require it to display correctly
> wrapped lines once a file is opened, as well as once the user explicitly 
> invokes a certain function while editing
> the file.

Thanks, but this proposal is unworkable, for several reasons.

First, reordering of bidirectional text is a display-time feature.
That means text in the buffer is left intact, in its original logical
order, and is reordered only when some portion of that text is being
considered for possible redisplay.  (I wrote "considered for possible
redisplay" on purpose, because many times the display engine will
decide that certain parts of the display have not changed, and
therefore this potential will not be realized for some of the text.)
The reordered characters appear in their visual order only in the data
structures used as part of redisplay, the buffer text retains its
original order.  These data structures are ephemeral and not
accessible from Lisp.

This means that wrapping lines when a file is first visited by Emacs
is meaningless, because most of the file will not be shown on-screen.
Likewise with the user invoking a command: it can only be done when an
incorrect display is already on the screen, and only for the part that
is actually displayed.

But there is a more fundamental reason why this will not be useful.
Almost everything the user does in Emacs causes a redisplay cycle.
Even when the user just moves the cursor, there is a redisplay
immediately after that.  If your cursor blinks (as it does by
default), each blink causes a redisplay cycle.  Each such redisplay
cycle compares the actual screen display with the desired one, and
redraws any parts that are different.  So unless the correct line
wrapping is part of the "normal" display, it will be very short-lived,
since the very next redisplay cycle might replace it with the
"incorrectly" wrapped lines.

All of this is due to the basics of the Emacs design: changes to
buffer text and other related objects made by the Lisp interpreter do
not directly drive the display.  Instead, when the Lisp interpreter
becomes idle (meaning that it is done with changing buffers and other
objects, as instructed by the last command), redisplay is
automatically called, and is responsible for figuring out what, if
anything, needs to be changed on display due to the changes made by
the Lisp interpreter.  It follows that you cannot "fix" redisplay
problems by something you do in Lisp.





reply via email to

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