discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Word selection and cursor placement


From: Matt Rice
Subject: Re: Word selection and cursor placement
Date: Sun, 19 Nov 2006 18:22:04 -0800 (PST)

--- Wolfgang Lux <wolfgang.lux@gmail.com> wrote:

> Andreas Höschler wrote:
> 
<snip good stuff>

> Changing -moveLeft: and -moveRight: is a little bit
> more complicated  
> because the selection should collapse to the left
> and right end,  
> respectively. For languages with left-to-right text
> flow (i.e.,  
> western languages), this ends will match the
> beginning and end of the  
> selection, respectively. Yet, for languages with a
> right-to-left text  
> flow (e.g. Hebrew or Arabic) the ends of the
> selection have to be  
> reversed. I leave it as an exercise for someone more
> knowledgeable  
> than me to fix this shortcoming in the following
> implementations of  
> moveLeft: and moveRight:.
> 

I don't know anything about right-to-left text flow,
but it seems to me that moveLeft: and moveRight should
have the same behaviour on both left->right and
right->left text because left is a literal direction,

corresponding to the left and right arrow keys,
i don't think that these should be affected by text
direction

where moveForward: and moveBackward: are non-literal
directions, which should be affected 

i notice slight differences in the documentation

-moveRight: should be placed at the right end of the
former selection.
-moveForward: should be place at the end of the former
selection.

otoh, i'm not sure if what you describe here is a
difference of behaviour, or a different implementation
required to achieve the same behaviour under both
left->right and right->left, if you could clarify that
a little


> - (void) moveLeft: (id)sender
> {
>    NSRange range = [self selectedRange];
> 
>    if (range.length)
>      // FIXME: this should be the *left* end of the
> selection
>      [self _moveTo: range.location select: NO];
>    else
>      [self _move: GSInsertionPointMoveLeft
>         distance: 0.0
>         select: NO];
> }
> 
> - (void) moveRight: (id)sender
> {
>    NSRange range = [self selectedRange];
> 
>    if (range.length)
>      // FIXME: this should be the *right* end of the
> selection
>      [self _moveTo: NSMaxRange(range) select: NO];
>    else
>      [self _move: GSInsertionPointMoveRight
>         distance: 0.0
>         select: NO];
> }
> 
> I also leave it as an exercise to fix the -moveUp:
> and -moveDown:  
> methods, which according to the documentation should
> move to the  
> character immediately above the beginning and
> immediately below the  
> end of the selection, respectively.
> 
> Similar fixes will be necessary in methods
> -moveWordForward: - 
> moveWordBackward:, -moveToBeginningOfParagraph:, - 
> moveToEndOfParagraph:, and maybe others. Look for
> [self  
> _movementOrigin] to find other places that
> eventually need to be fixed.
> 
> Hope this helps,
> Wolfgang
> 




 
____________________________________________________________________________________
Sponsored Link

Compare mortgage rates for today. 
Get up to 5 free quotes. 
Www2.nextag.com




reply via email to

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