Unicode bidi algorithm and editing




I've been working on making GtkEntry handle bidirectional
editing, and have come across a few cases where the behavior
seems counter-inutiutive and confusing.

One example is when entering a string of text that is counter
to the base direction for an entry.

Say, I want to type

"he said, ITS A CAR"

where the capitalized string is in a RTL language, with the
base direction being LTR.

After I type:

 "he said, ITS "

then, this is displayed as:

 "he said, STI |"
              

with the space afterwards, and the cursor after the space, since the
directionality of the neutral space is resolved to the base direction
in this case. But then I type the "A", and the display jumps to

 "he said, |A STI"
          
With the space properly positioned and the cursor after the A.
This jumping continues with every word entered. Perhaps this
is acceptable - after all, entering multi-word embedded strings
is most likely considerably less common than entering an
embedded single-word string. 

But it does strike me as confusing, and it gets really bad if the
string is long enough to force the entry to scroll to display the
cursor.

How is this generally handled? The only solutions I can see
are to:
 
 a) Put in explicit directional overrides for the space characters
    dependending on the direction of the keyboard

 b) Treat the cursor position specially when doing the directional
    reordering.

Neither of these seem at all attractive.

Regards,
                                        Owen










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