9 Oct 2009 23:18
Bidirectional editing in Emacs -- main design decisions
Eli Zaretskii <eliz <at> gnu.org>
2009-10-09 21:18:00 GMT
2009-10-09 21:18:00 GMT
As some of you know, I'm slowly working on adding support for bidirectional editing in Emacs. (Before you ask: the code is not publicly available yet, and won't be until Emacs switches to bzr as its main VCS.) While there's a lot of turf to be covered yet, I thought I'd publish the main design decisions up to this point. Many of these decisions were discussed at length years ago on emacs-bidi mailing list, and since then I also talked them over in private email with a few people. Other decisions were made recently, as I went about changing the display engine. My goal, and the main drive behind these design decisions was to preserve as much as possible the basic assumptions and design principles of the current Emacs display engine. This is not just opportunism; I firmly believe that any other way would mean a total redesign and rewrite of the display engine, which is something we want to avoid. Personally, if such a redesign would be necessary, I couldn't have participated in that endeavor, except as advisor. With that preamble out of my way, here's what I can tell about the subject at this point: 1. Text storage Bidirectional text in Emacs buffers and strings is stored in strict logical order (a.k.a. "reading order"). This is how most (if not all) other implementations handle bidirectional text. The advantage of this is that file and process I/O is trivial, as well as text search. The disadvantage is that text needs to be(Continue reading)
> The search has many problems but this should not influence your bidi
> reordering. The changes to various search functions can be done later.
Agreed.
> The user ALWAYS search for the visual text s/he sees (S/he never knows
> the logical order unless she visits the file literally).
She will look for visual text, but she will type the text she looks
for in the logical (reading) order, not in the visual order, where
characters are reversed and/or reshuffled.
> The problems are caused by many reasons:
> 1. Different logical inputs, even without formatting characters, can
> result in the same visual output.
> e.g. Logical Hebrew text + a number in LTR reading order, the
> number may be before or after the Hebrew text, but in the visual
> output the number will always be after (to the left of) the text.

RSS Feed