[Adium-devl] Auto alignment of message input field

Ofri Wolfus ofri.wolfus at gmail.com
Wed Jan 9 22:41:01 UTC 2008


Well, it may look like it but it's really not. -[NSString  
baseWritingDirection] (which is implemented in FriBidi.framework)  
starts looking at the characters of the string until it finds one  
which knows its own direction (like a letter), and then returns its  
result based on that. So instead of checking each time whether the  
beginning of the text in the input field was changed (the first letter  
dictates the entire direction), the entire string is being sent a - 
baseWritingDirection which is quite cheap in most cases. This is  
needed in order to handle the case where a use types something,  
deletes everything, and then types again in a different language, or  
when moving the typing marker to the beginning and inserting new text  
there.

Another identical check is being done when pasting text, again  
ignoring determining where the text was pasted as -[NSString  
baseWritingDirection] is really cheap usually. In both cases the user  
sees a change *only* when changing the beginning of the typed text,  
which is exactly the desired behavior.

This patch is useful mostly to people who write in both directions,  
sometimes even in the same conversation. It's a major little  
enhancement (at least in my opinion) in these cases, as you don't have  
to be satisfied with writing your message from the wrong side, nor  
changing the direction manually each time you switch language. I'm  
sorry if I wasn't clear enough before :)

Ofri

On 10/01/2008, at 00:12, Evan Schoenberg wrote:

> Correction after reading peter's comments - it does seem like perhaps
> an overly greedy check. Could we only do this when changing input
> languages or pasting text?
>
> Cheers,
> Evan
>
> On Jan 9, 2008, at 4:06 PM, Evan Schoenberg <evan.s at dreskin.net>  
> wrote:
>
>> It looks good to me.
>>
>> Cheers,
>> Evan
>>
>> On Jan 9, 2008, at 11:28 AM, Chris Forsythe <chris at adiumx.com> wrote:
>>
>>> Has anyone had a chance to review this patch?
>>>
>>> Chris
>>>
>>> On Jan 1, 2008, at 5:29 AM, Ofri Wolfus wrote:
>>>
>>>> Hi everyone,
>>>>
>>>> I suddenly realized it'll be very handy for people who write both
>>>> LTR and RTL messages if adium automatically set the writing
>>>> direction when typing a message, but as we're in a late beta I'm
>>>> asking first, whether we'd like this feature and second, if it's ok
>>>> to include it at this stage.
>>>> Attached is a patch which modifies AIMessageEntryTextView to auto
>>>> set its writing direction based on its content.
>>>>
>>>> What do you think?
>>>> Ofri
>>>>
>>>> <auto-dir.diff>
>>>>
>>>> _______________________________________________
>>>> Adium-devl mailing list
>>>> Adium-devl at adiumx.com
>>>> http://adiumx.com/mailman/listinfo/adium-devl_adiumx.com
>>>
>>>
>>> _______________________________________________
>>> Adium-devl mailing list
>>> Adium-devl at adiumx.com
>>> http://adiumx.com/mailman/listinfo/adium-devl_adiumx.com
>>>
>>
>> _______________________________________________
>> Adium-devl mailing list
>> Adium-devl at adiumx.com
>> http://adiumx.com/mailman/listinfo/adium-devl_adiumx.com
>>
>
> _______________________________________________
> Adium-devl mailing list
> Adium-devl at adiumx.com
> http://adiumx.com/mailman/listinfo/adium-devl_adiumx.com





More information about the devel mailing list