emacs-devel
[Top][All Lists]
Advanced

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

Re: How to recognize keyboard insertion?


From: Eli Zaretskii
Subject: Re: How to recognize keyboard insertion?
Date: Sun, 01 Nov 2009 21:57:27 +0200

> From: "Stephen J. Turnbull" <address@hidden>
> Cc: Jason Rumney <address@hidden>,
>     address@hidden,
>     address@hidden
> Date: Sun, 01 Nov 2009 14:25:42 +0900
> 
> Eli Zaretskii writes:
> 
>  > > User types: ABCD(4+5)*9
>  > > Displayed as: (4+5)*9DCBA Parens here must be LTR
>  > 
>  > No, it's displayed as 9*(4+5)DCBA.
> 
> That seems weird to me.  From my (probably imperfect) understanding of
> UAX#9 I would expect the following sequence of displays starting with
> an empty buffer (notation: uppercase letters are RTL, lowercase
> letters and digits are LTR, -!- is point):
> 
> -!-
> -!-A
> -!-BA
> -!-CBA
> -!-DCBA
> -!-)DCBA
> 4-!-)DCBA
> 4+-!-)DCBA
> 4+5-!-)DCBA      [1]
> -!-(4+5)DCBA     <-- point jumps
> (4+5)*-!-DCBA    <-- point jumps again
> (4+5)*9-!-DCBA

(When you say "point jumps", you actually mean "cursor jumps", right?
Because point does not jump at all, it always is after the last
character typed on each of the above lines.)

> I gather you're saying the correct interpretation of UAX#9 is
> (starting from [1]):
> 
> 4+5-!-)DCBA      [1]
> -!-(4+5)DCBA     <-- point jumps
> -!-*(4+5)DCBA
> 9-!-*(4+5)DCBA

Not exactly.  I didn't say anything about point or cursor location.
UAX#9 does not specify where to put the cursor and how it should move
during text insertion, and different implementations do it differently
for various reasons, some valid, some less so.  (There are two equally
``correct'' locations of the cursor, because buffer position changes
non-linearly with screen position, and "between two adjacent
characters" is no longer well defined.)

I didn't yet implement in Emacs anything beyond basic logical-order
cursor motion, whereby C-f moves to the next character in the logical
order.  I expect some quite heated debates regarding this, when the
time comes.  But for now I'm deliberately ignoring this issue, because
it's not a fundamental one.  It's a usability and UI issue, and all I
care at this point is to provide enough infrastructure to implement
any behavior we will want (and probably more than one) when the time
comes.

Coming back to the example, cursor motion is not important here.
Assume that this text comes from a file, where you have ABCD(4+5)*9 in
logical order.  The way this will be displayed depends on the
properties of the characters.  The key reason for the fact that * and
9 are to the left of the (4+5) is that (, ), and + are all "neutral"
characters, in UAX#9 parlance, while * is a "weak separator"
character.  That, and the fact that numbers get higher resolved levels
than the surrounding text, see 3.3.5 in UAX#9.  That's why "*9" is not
rendered to the right of "(4+5)".




reply via email to

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