feat: adding word actions, not done, and lots of failing tests #4
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/word-motions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a test for the new AI reviewing tool
Review please :)
/review
/review
Preparing review...
/review
Preparing review...
/review
Preparing review...
/review
Preparing review...
/review
Preparing review...
/review
Preparing review...
/review
PR Reviewer Guide 🔍
(Review updated until commit
6b8845b245)Here are some key observations to aid the review process:
Failing Tests
The tests for 'yB' and 'ygE' are explicitly marked as failing because the cursor is not moving to the start of the yanked region. This indicates a bug in how these backward WORD/word-end motions interact with the yank operator, specifically regarding cursor positioning after the operation.
Test Logic Review
The tests comparing 'dB' with 'db' (lines 1851-1871) and 'dgE' with 'dge' (lines 2380-2401) show identical expected outcomes for deleting text like 'hello.world next'. Given the distinction between 'word' and 'WORD' (where 'WORD' treats punctuation as part of the word), it's worth verifying if the expected behavior for deletion is truly identical in these cases, or if the tests should be adjusted to reflect a difference.
/review
Persistent review updated to latest commit
6b8845b245/improve
PR Code Suggestions ✨
Set cursor to yank start
The
yankNormalModefunction should explicitly set the cursor position to the startof the yanked region after the operation. Currently, the cursor remains at the
position determined by the motion, which causes failing tests for
yB,yge, andygEas noted in
integration_motion_word_test.go.internal/operator/yank.go [85-88]
Suggestion importance[1-10]: 9
__
Why: This suggestion correctly identifies and addresses a bug where the cursor position is not updated after a yank operation, as indicated by failing tests in
integration_motion_word_test.go. Setting the cursor to the start of the yanked region is crucial for correct Vim behavior.Correct backward word end calculation
The
prevWordEndfunction incorrectly identifies the end of the previous word. Afterskipping whitespace, the cursor
xis positioned at the start of the target word,not its end. An additional step is needed to advance
xto the last character of thatword, based on its character class, to match Vim's
gebehavior.internal/motion/word.go [519-539]
Suggestion importance[1-10]: 9
__
Why: The
prevWordEndfunction, as implemented, incorrectly positions the cursor at the start of the word after skipping whitespace. The suggestion provides a correct fix by adding logic to advance the cursor to the actual end of the word, which is essential for thegemotion to function as expected.Correct backward WORD end calculation
The
prevWORDEndfunction also incorrectly identifies the end of the previous WORD.Similar to
prevWordEnd, after skipping whitespace, the cursorxis at the start ofthe target WORD. An additional loop is required to advance
xto the last characterof that WORD, matching Vim's
gEbehavior.internal/motion/word.go [579-599]
Suggestion importance[1-10]: 9
__
Why: Similar to
prevWordEnd, theprevWORDEndfunction also incorrectly places the cursor at the start of the WORD. The suggested change correctly adds the necessary logic to move the cursor to the end of the WORD, ensuring thegEmotion behaves as intended.