-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add support for by word movement granularities to semantics #19949
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
Add support for by word movement granularities to semantics #19949
Conversation
|
Analyze died quickly for some reason so macos tests didn't run, should pass and will rerun when it is done. |
goderbauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| return; | ||
| final int baseOffset = !extentSelection ? nextWord.start : _selection.baseOffset; | ||
| onSelectionChanged( | ||
| new TextSelection(baseOffset: baseOffset, extentOffset: nextWord.start), this, SelectionChangedCause.keyboard); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe put each argument on a separate line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| final TextRange nextWord = _getNextWord(currentWord.end); | ||
| if (nextWord == null) | ||
| return; | ||
| final int baseOffset = !extentSelection ? nextWord.start : _selection.baseOffset; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be easier to comprehend if you switch it around and remove the negation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| if (!_onlyWhitespace(range)) | ||
| return range; | ||
| offset = range.start - 1; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this missing a return statement if offset drops below 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| for (int i = range.start; i < range.end; i++) { | ||
| final int codeUnit = text.codeUnitAt(i); | ||
| switch (codeUnit) { | ||
| case 0x9: // horizontal tab |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you link to where this list is coming from in case we need to update it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Extends the movement granularity support by text to byWord. To mimic the Android implementation, we skip words which only contain whitespace and unicode separator values.
Fixes #13389
Work towards #13406