Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

previousWord and NonDigits includes the precending whitespace #69

Closed
Ambior opened this issue Jul 8, 2014 · 6 comments
Closed

previousWord and NonDigits includes the precending whitespace #69

Ambior opened this issue Jul 8, 2014 · 6 comments

Comments

@Ambior
Copy link

Ambior commented Jul 8, 2014

Hi Tomas,

if a word starts with a number, the selection after previousWord() includes the precending whitespace.
The function NavigationActions.previousWord() calls !Character.isLetter(text.charAt(pos)) and moves to the precending position.
I supose this is a bug?!

greetings Roel.

@TomasMikula
Copy link
Member

I changed it to always skip two word boundaries.

@Ambior
Copy link
Author

Ambior commented Jul 9, 2014

Hi Tomas,

thanks for the fast reaction. I wonder about the last call to wordBreakIterator.previous(). This includes the previous whitespace in the selection. Is this intended to be so?

greeting
Roel

@Ambior Ambior changed the title previousWord and NonDigits includes the precending whtiespace previousWord and NonDigits includes the precending whitespace Jul 9, 2014
@TomasMikula
Copy link
Member

It has the property that if the caret is at the end of a word, it jumps to the end of the previous word, and if the caret is at the beginning of a word, it jumps to the beginning of the previous word. So you can say it is consistent in this way. Always jumping to the beginning of a word is also an option, consistent in a different way. I don't know which one is better.

When I Ctrl+Left/Ctrl+Right navigate in any text editor, 50% of the time I have to adjust the caret position by one space to get it where I wanted, no matter how the editor implements word navigation (because 50% of the time I want to go to the end of the word and 50% of the time to the beginning of the word). Therefore, I didn't think too hard what the exact behavior should be, as long as it's close to what one expects.

@ghost
Copy link

ghost commented Jul 9, 2014

Can this be a setting maybe? setNavigation() method for example?
On 09/07/2014 6:04 AM, TomasMikula wrote:

It has the property that if the caret is at the end of a word, it
jumps to the end of the previous word, and if the caret is at the
beginning of a word, it jumps to the beginning of the previous word.
So you can say it is consistent in this way. Always jumping to the
beginning of a word is also an option, consistent in a different way.
I don't know which one is better.

When I Ctrl+Left/Ctrl+Right navigate in any text editor, 50% of the
time I have to adjust the caret position by one space to get it where
I wanted, no matter how the editor implements word navigation (because
50% of the time I want to go to the end of the word and 50% of the
time to the beginning of the word).


Reply to this email directly or view it on GitHub
#69 (comment).

@TomasMikula
Copy link
Member

I don't want to overcomplicate such a trivial thing. If someone really wants to override the default behavior, they can register an event filter and implement the navigation themselves.

@ghost
Copy link

ghost commented Jul 9, 2014

yea make sense :)
On 09/07/2014 11:44 AM, TomasMikula wrote:

I don't want to overcomplicate such a trivial thing. If someone really
wants to override the default behavior, they can register an event
filter and implement the navigation themselves.


Reply to this email directly or view it on GitHub
#69 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants