You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for picking this up, @paulluis-roehl! The tests fit right in with the existing ones.
I tried a few edge cases on the branch and found some spots where it doesn't match Vim:
dW on the last word of a line joins it with the next line. With foo bar\n baz and the cursor on bar, dW gives foo baz. W treats the newline and the indent as normal spaces and skips them. Vim stops at the end of the line, so you'd get foo \n baz.
dE at the very end of the text deletes the last character. With foo and the cursor after the last o (offset 3), dE deletes the o. wordMotion returns len - 1, which is smaller than the cursor, so Math.min(offset, target) flips the range. Vim does nothing here. Same for yE.
cW should work like cE. With foo.bar baz and the cursor at 0, cW also deletes the space after foo.bar, so typing x gives xbaz. Vim keeps the space and gives x baz. The test "cW deletes from cursor to start of next WORD" would need to change too.
Vim treats an empty line as a WORD. With foo\n\nbar, W from the start jumps to bar, but Vim stops on the empty line first. So 2W goes one too far for each blank line.
Visual B sends the range backwards, e.g. selectRange { start: 20, end: 12 }. I'm not sure setSelectionInclusive handles start > end, and I haven't tried it in OpenCode yet. Sorting the two with Math.min/Math.max first would be safe either way.
A couple of smaller things:
The early returns (dW at the end of the text, dB at the start) and counts like 2dW / d2B don't have tests yet.
The E case is almost a copy of endOfWord (the TODO says so). Not a blocker, but sharing one loop would mean less to keep in sync.
Happy to help with any of these if you get stuck.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Summary
W,B, andEmotions that keep punctuation and URLs together.etest cases and assertion style.Closes #88
Validation