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

added nowrap option #3192

Closed
wants to merge 5 commits into from
Closed

added nowrap option #3192

wants to merge 5 commits into from

Conversation

Rjongenburger
Copy link

What this PR does / why we need it:
This PR implements the wrapscan option.

Which issue(s) this PR fixes
Fixes: #3155

Copy link
Member

@jpoon jpoon left a comment

Choose a reason for hiding this comment

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

Awesome 💯 . Can you add some tests?

@@ -223,8 +223,19 @@ export class SearchState {
}

const effectiveDirection = direction * this._searchDirection;
const forward = effectiveDirection === SearchDirection.Forward;
Copy link
Member

Choose a reason for hiding this comment

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

Can you rename this to isForward?

if (!configuration.wrapscan) {
const last = this._matchRanges.length - 1;
if (
(forward && this._matchRanges[last].contains(startPosition)) ||
Copy link
Member

Choose a reason for hiding this comment

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

No need to declare last var. I think you can combine it all to 231.

(forward && this._matchRanges[last].contains(startPosition)) ||
(!forward && this._matchRanges[0].contains(startPosition))
) {
return { start: startPosition, end: startPosition, match: false };
Copy link
Member

Choose a reason for hiding this comment

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

match: false

I don't recall the code path, but what is this match used for? Shouldn't it be true?

package.json Outdated
},
"vim.wrapscan": {
"type": "boolean",
"description": "when \"search next\" reaches end of file, it wraps around to the beginning and vice versa",
Copy link
Member

Choose a reason for hiding this comment

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

Can we use vim's help text here directly?

http://vimdoc.sourceforge.net/htmldoc/options.html#'wrapscan'.

Searches wrap around the end of the file.

@TravisBuddy
Copy link

Hey @Rjongenburger,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: ec478e50-e117-11e8-90db-29214a2b47d8

@VSCodeVim VSCodeVim deleted a comment from TravisBuddy Nov 5, 2018
This was referenced Aug 30, 2019
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.

Does not support nowrapscan
3 participants