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 error when count exceeds max number of rows in "[count]Y/J" #4628

Merged
merged 7 commits into from Mar 30, 2020

Conversation

lusingander
Copy link
Contributor

What this PR does / why we need it:

An error occurred when executing yank(Shift+y) or join(Shift+j) with a count exceeding the number of lines in the file.

(e.g. execute 1000Y on the 100 line file.)

So I fixed it to calculate the number of rows to be processed using Position#getDownByCount.

Which issue(s) this PR fixes

Fixes #4625

Special notes for your reviewer:

error occured if count is larger than number of lines
error occured if count is larger than number of lines
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I think we need more tests.

test/mode/modeNormal.test.ts Show resolved Hide resolved
test/mode/normalModeTests/commands.test.ts Show resolved Hide resolved
@lusingander lusingander changed the title Fix error in "[count]Y/J" with large count Fix error when count exceeds max number of rows in "[count]Y/J" Mar 7, 2020
@J-Fields J-Fields added this to the v1.14.0 milestone Mar 27, 2020
@TravisBuddy
Copy link

Travis tests have failed

Hey @lusingander,
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: 12

View build log

if [[ $(git diff-index HEAD -- *.js *.ts *.md) ]]; then git diff; echo "Prettier Failed. Run `gulp forceprettier` and commit changes to resolve."; exit 1; fi
The command "if [[ $(git diff-index HEAD -- *.js *.ts *.md) ]]; then git diff; echo "Prettier Failed. Run `gulp forceprettier` and commit changes to resolve."; exit 1; fi" exited with 0.
$ npm run build

> vim@1.13.1 build /home/travis/build/VSCodeVim/Vim
> gulp build

[11:55:18] Using gulpfile ~/build/VSCodeVim/Vim/gulpfile.js
[11:55:18] Starting 'build'...
[11:55:18] Starting 'prettier'...
[11:55:18] Finished 'prettier' after 30 ms
[11:55:18] Starting 'tsc'...
[11:55:18] Starting 'tslint'...
src/actions/commands/actions.ts(2143,26): error TS2339: Property 'getDownByCount' does not exist on type 'Position'.
src/actions/commands/actions.ts(3078,34): error TS2339: Property 'getDownByCount' does not exist on type 'Position'.
TypeScript: 2 semantic errors
TypeScript: emit failed
[11:55:32] The following tasks did not complete: build, <parallel>, tsc, tslint
[11:55:32] Did you forget to signal async completion?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vim@1.13.1 build: `gulp build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vim@1.13.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/travis/.npm/_logs/2020-03-30T11_55_32_024Z-debug.log
The command "npm run build" exited with 1.
$ npm test

> vim@1.13.1 test /home/travis/build/VSCodeVim/Vim
> node ./node_modules/vscode/bin/test

### VS Code Extension Test Run ###

Current working directory: /home/travis/build/VSCodeVim/Vim
Downloading VS Code 1.43.2 into .vscode-test/vscode-1.43.2.
Downloading VS Code from: https://update.code.visualstudio.com/1.43.2/linux-x64/stable
Downloaded VS Code 1.43.2
Running extension tests: /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/code /home/travis/build/VSCodeVim/Vim/test --extensionDevelopmentPath=/home/travis/build/VSCodeVim/Vim --extensionTestsPath=/home/travis/build/VSCodeVim/Vim/test --locale=en
[main 2020-03-30T11:55:36.491Z] update#setState idle

bash: cannot set terminal process group (-1): Inappropriate ioctl for device

bash: no job control in this shell

(node:5838) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:5838) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:5838) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information
(node:5838) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:5838) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:5838) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

Error: Error: Cannot find module '/home/travis/build/VSCodeVim/Vim/test'
Require stack:
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/vs/loader.js
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/bootstrap-amd.js
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/bootstrap-fork.js
	at d._doHandleExtensionTests (/home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:725:405)

Error: Cannot find module '/home/travis/build/VSCodeVim/Vim/test'
Require stack:
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/vs/loader.js
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/bootstrap-amd.js
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/bootstrap-fork.js: Error: Error: Cannot find module '/home/travis/build/VSCodeVim/Vim/test'
Require stack:
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/vs/loader.js
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/bootstrap-amd.js
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/bootstrap-fork.js
	at d._doHandleExtensionTests (/home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:725:405)

(node:6397) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:6397) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

Tests exited with code: 1
npm ERR! Test failed.  See above for more details.
The command "npm test" exited with 1.
store build cache
changes detected (content changed, file is created, or file is deleted):\n/home/travis/.npm/_logs/2020-03-30T11_55_32_024Z-debug.log\n
changes detected, packing new archive
cache uploaded


Done. Your build exited with 1.
npm run build
> vim@1.13.1 build /home/travis/build/VSCodeVim/Vim
> gulp build

[11:55:18] Using gulpfile ~/build/VSCodeVim/Vim/gulpfile.js
[11:55:18] Starting 'build'...
[11:55:18] Starting 'prettier'...
[11:55:18] Finished 'prettier' after 30 ms
[11:55:18] Starting 'tsc'...
[11:55:18] Starting 'tslint'...
src/actions/commands/actions.ts(2143,26): error TS2339: Property 'getDownByCount' does not exist on type 'Position'.
src/actions/commands/actions.ts(3078,34): error TS2339: Property 'getDownByCount' does not exist on type 'Position'.
TypeScript: 2 semantic errors
TypeScript: emit failed
[11:55:32] The following tasks did not complete: build, <parallel>, tsc, tslint
[11:55:32] Did you forget to signal async completion?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vim@1.13.1 build: `gulp build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vim@1.13.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/travis/.npm/_logs/2020-03-30T11_55_32_024Z-debug.log
npm test
> vim@1.13.1 test /home/travis/build/VSCodeVim/Vim
> node ./node_modules/vscode/bin/test

### VS Code Extension Test Run ###

Current working directory: /home/travis/build/VSCodeVim/Vim
Downloading VS Code 1.43.2 into .vscode-test/vscode-1.43.2.
Downloading VS Code from: https://update.code.visualstudio.com/1.43.2/linux-x64/stable
Downloaded VS Code 1.43.2
Running extension tests: /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/code /home/travis/build/VSCodeVim/Vim/test --extensionDevelopmentPath=/home/travis/build/VSCodeVim/Vim --extensionTestsPath=/home/travis/build/VSCodeVim/Vim/test --locale=en
[main 2020-03-30T11:55:36.491Z] update#setState idle

bash: cannot set terminal process group (-1): Inappropriate ioctl for device

bash: no job control in this shell

(node:5838) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:5838) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:5838) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information
(node:5838) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:5838) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:5838) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

Error: Error: Cannot find module '/home/travis/build/VSCodeVim/Vim/test'
Require stack:
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/vs/loader.js
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/bootstrap-amd.js
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/bootstrap-fork.js
	at d._doHandleExtensionTests (/home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:725:405)

Error: Cannot find module '/home/travis/build/VSCodeVim/Vim/test'
Require stack:
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/vs/loader.js
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/bootstrap-amd.js
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/bootstrap-fork.js: Error: Error: Cannot find module '/home/travis/build/VSCodeVim/Vim/test'
Require stack:
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/vs/loader.js
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/bootstrap-amd.js
- /home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/bootstrap-fork.js
	at d._doHandleExtensionTests (/home/travis/build/VSCodeVim/Vim/.vscode-test/vscode-1.43.2/VSCode-linux-x64/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:725:405)

(node:6397) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:6397) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

Tests exited with code: 1
npm ERR! Test failed.  See above for more details.
TravisBuddy Request Identifier: 66204210-727d-11ea-9d77-7bbee09565ec

@J-Fields J-Fields merged commit 33f3c88 into VSCodeVim:master Mar 30, 2020
@lusingander lusingander deleted the fix/yank-join-with-count branch March 30, 2020 23:58
@J-Fields J-Fields removed this from the v1.15.0 milestone May 2, 2020
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.

10000 Shift-Y causes error
3 participants