[Adium-devl] Auto alignment of message input field

Ofri Wolfus ofri.wolfus at gmail.com
Fri Jan 18 14:49:32 UTC 2008


As far as I understand it (I'm not a unicode/bidi expert) characters  
can be divided to two types - with or without direction of their own.  
Characters like letters have a definite direction as they belong to a  
specific language, but characters like numbers, dots, question marks  
and so on are shared between languages with different directions, and  
therefor can't tell the direction of the text. Performing the check  
only when the string's length is 0 will work only if the user starts  
the message with a letter. If it starts with a number for example, it  
won't catch. So in order to make life simple, I decided to just check  
every time which should catch everything (except pasting text, which  
for some reason doesn't invoke -insertText:).

Ofri

On 18/01/2008, at 16:31, Evan Schoenberg wrote:

> That makes sense... So some characters don't provide a defined
> direction?  If a single character could determine desired direction,
> it seems like only checking at all when the current length of the
> string in the text view is 0 would accomplish that without scanning ok
> each typed char...but if the algorithm is quick (particularly using
> the stack rather than making extra allocations for the check) it
> probably makes no difference.





More information about the devel mailing list