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 in Page #367

Closed
zernyu opened this issue Jun 30, 2011 · 9 comments
Closed

Regex Find in Page #367

zernyu opened this issue Jun 30, 2011 · 9 comments

Comments

@zernyu
Copy link

zernyu commented Jun 30, 2011

Could you include an option to have the Find in Page feature accept regular expressions? That would be awesome, thanks for this extension!

@angelonuffer
Copy link
Contributor

I'm working on it at my fork.

@int3
Copy link
Collaborator

int3 commented Jan 15, 2012

This is now implemented in the regex-find branch.

The current UX is a stripped down version of what's available in Pentadactyl (see here for more details) -- essentially the search string is treated as a regex if the user types '\r' in the search query. By default the query is treated as a plain string. It doesn't sound very elegant, but I think it makes sense -- if the user at any point realizes that he needs a regex he can switch it on very easily, without losing what he has typed before. Pentadactyl uses these flags to toggle case sensitivity, too, and I think it would make sense for us to add that in as well in the future. @philc and @ilya, any comments on the UX or on the code?

Also, we should probably document this somewhere. Perhaps we could start a guide that's similar to what Pentadactyl has, and link to it via our help dialog?

@int3
Copy link
Collaborator

int3 commented Jan 17, 2012

Okay, I polished up the whole find service on the regex-find branch. It still needs a bit of refactoring but I think I'm mostly done. Here's what we have:

  • Regex support (turned on by the \r escape sequence)
  • Smartcase searching is the default now (case sensitivity is triggered by uppercase characters)
  • Case sensitivity can be enforced using the \I escape sequence
  • Find queries are now global across tabs and persistent across browser sessions
  • Page shortcuts e.g. on GitHub should no longer be triggered during find mode
  • Find mode no longer triggers insert mode if there are input elements that match the query, but we can enter insert mode on one of the results by hitting <esc>. This last feature was the hardest / most complicated to build, due to weird DOM issues.

Thoughts about the code: Could probably be more OO and better encapsulated, but I didn't want to create too much code churn by moving everything into a new file. I definitely plan to create a domUtils.js file though. @philc -- if this is good, I'm going to add some user documentation and merge it into master.

@philc
Copy link
Owner

philc commented Jan 17, 2012

Thanks Jez. I'll have a look.

@int3
Copy link
Collaborator

int3 commented Jan 22, 2012

I've made several changes to other aspects of vimium that aren't directly related to the find service but are incompatible with the differences between regex-find and master, so I've left them on regex-find. These changes in turn make future ones more likely to be incompatible. If it's fine with you, I'd like to merge regex-find back into master first, so I don't have to juggle branches. We can still refine the code from there.

@int3
Copy link
Collaborator

int3 commented Sep 3, 2012

This feature was completed and merged a while ago.

@int3 int3 closed this as completed Sep 3, 2012
@ElijahLynn
Copy link

Just want to say thanks for all the work on this feature, it is great!

@niedzielski
Copy link

For others seeking to turn this feature on as the default behavior, this is under options as "Treat find queries as regular expressions". It's great!

@sohanglal
Copy link

For others seeking to turn this feature on as the default behavior, this is under options as "Treat find queries as regular expressions". It's great!

Thanks @niedzielski!

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

No branches or pull requests

8 participants
@philc @int3 @angelonuffer @zernyu @niedzielski @ElijahLynn @sohanglal and others