-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
added nowrap option #3192
Conversation
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.
Awesome 💯 . Can you add some tests?
src/state/searchState.ts
Outdated
@@ -223,8 +223,19 @@ export class SearchState { | |||
} | |||
|
|||
const effectiveDirection = direction * this._searchDirection; | |||
const forward = effectiveDirection === SearchDirection.Forward; |
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.
Can you rename this to isForward
?
src/state/searchState.ts
Outdated
if (!configuration.wrapscan) { | ||
const last = this._matchRanges.length - 1; | ||
if ( | ||
(forward && this._matchRanges[last].contains(startPosition)) || |
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.
No need to declare last
var. I think you can combine it all to 231.
src/state/searchState.ts
Outdated
(forward && this._matchRanges[last].contains(startPosition)) || | ||
(!forward && this._matchRanges[0].contains(startPosition)) | ||
) { | ||
return { start: startPosition, end: startPosition, match: false }; |
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.
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", |
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.
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.
Without it you could bypass it by pressing n on another character than the matchrange.
Hey @Rjongenburger, TravisCI finished with status TravisBuddy Request Identifier: ec478e50-e117-11e8-90db-29214a2b47d8 |
What this PR does / why we need it:
This PR implements the wrapscan option.
Which issue(s) this PR fixes
Fixes: #3155