Skip to content
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

[Fix] aW doesn't work at the end of lines #2591

Merged
merged 1 commit into from
May 3, 2018

Conversation

tyru
Copy link
Contributor

@tyru tyru commented May 1, 2018

What this PR does / why we need it

This fixes aW behavior at the WORD (big word) of the end of line or the end of document.

Which issue(s) this PR fixes

Fixes #2571

@TravisBuddy
Copy link

Travis tests have failed

Hey @tyru,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

Node.js: 8

if [[ $(git diff-index HEAD --) ]]; then git diff; echo "Prettier Failed. Run `gulp` or `gulp forceprettier`"; exit 1; fi
diff --git a/src/actions/textobject.ts b/src/actions/textobject.ts
index 041e458..d8294ff 100644
--- a/src/actions/textobject.ts
+++ b/src/actions/textobject.ts
@@ -109,7 +109,7 @@ export class SelectABigWord extends TextObjectMovement {
       if (
         (nextWord.line > position.line || nextWord.isAtDocumentEnd()) &&
         vimState.recordedState.count === 0
-       ) {
+      ) {
         if (position.getLastBigWordEnd().isLineBeginning()) {
           start = position.getLastBigWordEnd();
         } else {
diff --git a/test/mode/modeNormal.test.ts b/test/mode/modeNormal.test.ts
index 8c0ff71..75768ad 100644
--- a/test/mode/modeNormal.test.ts
+++ b/test/mode/modeNormal.test.ts
@@ -795,28 +795,28 @@ suite('Mode Normal', () => {
   });
 
   newTest({
-    title: "Can handle 'daW' around word at the last WORD (class=\"btn\"|>)",
+    title: 'Can handle \'daW\' around word at the last WORD (class="btn"|>)',
     start: ['<div class="btn"|>', 'foo'],
     keysPressed: 'daW',
     end: ['<di|v', 'foo'],
   });
 
   newTest({
-    title: "Can handle 'daW' around word at the last WORD of the end of document (class=\"btn\"|>)",
+    title: 'Can handle \'daW\' around word at the last WORD of the end of document (class="btn"|>)',
     start: ['<div class="btn"|>'],
     keysPressed: 'daW',
     end: ['<di|v'],
   });
 
   newTest({
-    title: "Can handle 'daW' around word at the last WORD (c|lass=\"btn\">)",
+    title: 'Can handle \'daW\' around word at the last WORD (c|lass="btn">)',
     start: ['<div c|lass="btn">', 'foo'],
     keysPressed: 'daW',
     end: ['<di|v', 'foo'],
   });
 
   newTest({
-    title: "Can handle 'daW' around word at the last WORD of the end of document (c|lass=\"btn\">)",
+    title: 'Can handle \'daW\' around word at the last WORD of the end of document (c|lass="btn">)',
     start: ['<div c|lass="btn">'],
     keysPressed: 'daW',
     end: ['<di|v'],
Warning: The 'no-use-before-declare' rule requires type information.
Prettier Failed. Run [21:14:50] Using gulpfile ~/build/VSCodeVim/Vim/gulpfile.js
[21:14:50] Starting 'prettier'...
[21:14:50] Starting 'tslint'...
[21:14:50] Starting 'compile'...
[21:14:52] Finished 'prettier' after 1.64 s
[21:15:07] Finished 'tslint' after 16 s
src/common/motion/position.ts(975,42): error TS2345: Argument of type 'number | ((start?: number | undefined, end?: number | undefined) => number[]) | ((...items: numbe...' is not assignable to parameter of type 'number'.
  Type '(start?: number | undefined, end?: number | undefined) => number[]' is not assignable to type 'number'.
TypeScript: 1 semantic error
TypeScript: emit succeeded (with errors)
[21:15:16] Finished 'compile' after 26 s
[21:15:16] Starting 'default'...
[21:15:16] Finished 'default' after 42 μs or [21:15:17] Using gulpfile ~/build/VSCodeVim/Vim/gulpfile.js
[21:15:17] Starting 'forceprettier'...
[21:15:27] Finished 'forceprettier' after 9.43 s

@tyru tyru force-pushed the fix-aW-at-the-eol branch from 548a62d to 4f02633 Compare May 1, 2018 21:17
@xconverge xconverge merged commit 564bc02 into VSCodeVim:master May 3, 2018
@tyru tyru deleted the fix-aW-at-the-eol branch May 3, 2018 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aW doesn't work at the end of lines
3 participants