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

(Shift) + Shortcut + Left/Right skips only 1 word boundary, not 2 #370

Merged
merged 1 commit into from
Oct 5, 2016

Conversation

JordanMartinez
Copy link
Contributor

This fixes #200. I could write a test for it, but that would require adding a TestFX test dependency in headless mode so that the travis build still works correctly.

@JordanMartinez
Copy link
Contributor Author

Any comments on this?

@TomasMikula
Copy link
Member

I'm afraid this fix would cause the caret to move like this, i.e. sometimes skipping just the space:

|foo bar baz
foo| bar baz
foo |bar baz
foo bar| baz
foo bar |baz
foo bar baz|

@JordanMartinez
Copy link
Contributor Author

.... isn't that kind of the point? If it's something you don't want in RTFX, then that issue should have been closed a long time ago.

@TomasMikula
Copy link
Member

I think this is the desired behavior:

When moving to the right:

  • If there is a space to the right of the caret, then skip two boundaries.
  • If there is a word character to the right of the caret, then skip just one boundary.

Analogously when moving to the left.

This is different from both the current state and this PR.

@JordanMartinez
Copy link
Contributor Author

The new commit should do it.

@JordanMartinez
Copy link
Contributor Author

Shouldn't this also factoring in tabs?

@TomasMikula
Copy link
Member

I would use isWhitespace.

@JordanMartinez
Copy link
Contributor Author

How's that?

On another hand, it doesn't work if there are multiple blank lines between one word and the next. The caret | by word1 would stop twice before reaching word2:

word1|

|

|word2

Is that desired?

@TomasMikula
Copy link
Member

Well, that is also the current behavior. I think it is a problem of BreakIterator.getWordInstance() that it considers a line break as a word boundary.

@TomasMikula TomasMikula merged commit b518c6a into FXMisc:master Oct 5, 2016
@JordanMartinez JordanMartinez deleted the skipOneWordBoundary branch October 6, 2016 02:48
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

Successfully merging this pull request may close these issues.

(Shift)+Shortcut+Left/Right skips one too many word boundaries.
2 participants