-
-
Notifications
You must be signed in to change notification settings - Fork 40
feat(motions): add bw #126
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -100,6 +100,46 @@ add_task(async function test_normal_diw() { | |||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| add_task(async function test_normal_dw() { | ||||||||||||||||||||||||||
| await BrowserTestUtils.withNewTab(INPUT_TEST_FILE, async browser => { | ||||||||||||||||||||||||||
| const { set_text, test_edit, set_selection } = GlideTestUtils.make_input_test_helpers(browser, { | ||||||||||||||||||||||||||
| text_start: 1, | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| await set_text("Hello world", "dw at start of word deletes word + following space"); | ||||||||||||||||||||||||||
| await set_selection(0); | ||||||||||||||||||||||||||
| await test_edit("dw", "world", 0, "w"); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| await set_text("Hello world", "dw from inside a word deletes to next word boundary (keeps preceding chars)"); | ||||||||||||||||||||||||||
| await set_selection(2); | ||||||||||||||||||||||||||
| await test_edit("dw", "Heworld", 2, "w"); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| await set_text("Hello world", "dw at start deletes word + all following spaces"); | ||||||||||||||||||||||||||
| await set_selection(0); | ||||||||||||||||||||||||||
| await test_edit("dw", "world", 0, "w"); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| await set_text("Hello world", "dw from inside a word deletes to next word, skipping extra spaces"); | ||||||||||||||||||||||||||
| await set_selection(2); | ||||||||||||||||||||||||||
| await test_edit("dw", "Heworld", 2, "w"); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| await set_text("Hello, world", "dw stops at punctuation (keeps punctuation and following space)"); | ||||||||||||||||||||||||||
| await set_selection(0); | ||||||||||||||||||||||||||
| await test_edit("dw", ", world", 0, ","); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| await set_text("hello\nworld", "dw treats newline as whitespace and deletes it with the word"); | ||||||||||||||||||||||||||
| await set_selection(0); | ||||||||||||||||||||||||||
| await test_edit("dw", "world", 0, "w"); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| await set_text("hello?.world", "dw on punctuation run deletes punctuation up to next word"); | ||||||||||||||||||||||||||
| await set_selection(5); | ||||||||||||||||||||||||||
| await test_edit("dw", "helloworld", 5, "w"); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| await set_text("h h h", "dw deletes a single-letter word + following space"); | ||||||||||||||||||||||||||
| await set_selection(2); | ||||||||||||||||||||||||||
| await test_edit("dw", "h h", 2, "h"); | ||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: you can also set the expected char to make the test easier to read, and I also like to avoid duplicate chars for the same reason
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for your comment. |
||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| add_task(async function test_normal_w() { | ||||||||||||||||||||||||||
| await BrowserTestUtils.withNewTab(INPUT_TEST_FILE, async browser => { | ||||||||||||||||||||||||||
| const { set_text, test_motion, set_selection } = GlideTestUtils.make_input_test_helpers(browser, { text_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.
for what its worth, I'm surprised the
text_obj.cls(current_char(editor)) !== starting_clscheck didn't fix thehello\nworldcase you mention in the description?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.
for the EOL case in particular, did you try the
is_eolhelper?glide/src/glide/browser/base/content/motions.mts
Line 603 in c09d674
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.
Thank you for your comment. Sorry for the delay, but I have also been able to handle cases including line breaks, so could you please check it?
295d46f