Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, in
foo b|ar
where|
indicates the cursor position,Cursor::previous_logical_word
will returnfoo| bar
. This doesn't match the behavior ofCursor::{next_logical_word, previous_visual_word}
which place the cursor at the boundary of the current word. This happens becauseCluster::previous_logical_word
is called from the upstream cluster (the "b") and the cursor then lands between the "o" and the space.This also renames "left", "right" -> "upstream", "downstream" (naming copied from
Cursor::logical_clusters
) to make it clear we're operating in logical order and not visual, and setsmoving_right
based on the text direction we're jumping to, to set the affinity of the cursor towards the word whose boundary it lands on.(Note the behavior between
{previous, next}_logical_word
and{previous, next}_visual_word
aren't quite the same yet: thevisual
methods jump over whitespace, thelogical
ones don't.)