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

Regex find with line start matches mid-line on "find next" #10887

Closed
mrwonko opened this issue Aug 24, 2016 · 1 comment
Closed

Regex find with line start matches mid-line on "find next" #10887

mrwonko opened this issue Aug 24, 2016 · 1 comment
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug editor-find Editor find operations verified Verification succeeded

Comments

@mrwonko
Copy link

mrwonko commented Aug 24, 2016

  • VSCode Version: 1.4.0
  • OS Version: Mac OS X 10.11.6

Steps to Reproduce:

  1. Open/create a document containing a line with multiple characters except {
    1. alternatively, just fill the line with a bunch of as
  2. Search for ^[^{]. The first character of the matching line is selected, as expected, with the find box stating something like "1 of 338"
    1. or ^a, if you went with 1.i
  3. Find next. Instead of going to the next matching line, the next character on the current line is selected, with the find box stating "? of 338"
  4. Find previous works as expected

It seems as if the search is run on the substring starting after the current match; but the beginning of this substring is erroneously interpreted as "start of line".

A symmetric issue occurs with a$ and find previous.

For the moment, my workaround is searching for ^[^{].*$

@sandy081 sandy081 added editor-find Editor find operations bug Issue identified by VS Code Team member as probable bug labels Aug 25, 2016
@sandy081 sandy081 self-assigned this Aug 25, 2016
@sandy081 sandy081 added this to the August 2016 milestone Aug 25, 2016
@sandy081
Copy link
Member

Find is broken if reg ex has beginning of line pattern for some cases. When cursor is at the beginning of the line, Find next gives correct result. Otherwise not.

Because, find next takes the input from current position. If at current position, it starts with expected match then it matches it and goes into a bad state.

Simple case: ifif with reg ex ^if => Get me all lines that start with if

aug-31-2016 16-52-57

@sandy081 sandy081 modified the milestones: September 2016, August 2016 Aug 31, 2016
@sandy081 sandy081 added the editor label Sep 6, 2016
@roblourens roblourens added the verified Verification succeeded label Sep 29, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug editor-find Editor find operations verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants