Incremental search while typing in the Find bar #1781

Merged
merged 1 commit into from Oct 12, 2012

2 participants

@peterflynn
Adobe Systems Incorporated member

This changes the Find (within file) feature so the first matching result is highlighted as you type, instead of after you press Enter. Navigating to subsequent/previous results still works the same as before.

Although highlighting all matches (mark occurrences) is turned off in our CSS, the changes here were tested & should work when/if highlights are made visible again.

Also includes some docs improvements.

@peterflynn peterflynn Incremental search while typing in the Find bar
Although highlighting matches is turned off in our CSS, the changes here
were tested & should work when/if highlights are made visible again.

Also includes some docs improvements.
b337028
@redmunds redmunds was assigned Oct 8, 2012
@redmunds

Very cool!

I notice a couple usability quirks with this:

  1. Incremental search does not recognize when typing a RegExp search argument. For example, I want to search on "THE" exact word matches, so my final search argument is "/\bTHE\b/" (without quotes). As I type, I see a hit on a forward slash (actually, I don't - see quirk 2), then no more hits until I type the final forward slash. I suppose some people may want to seach their doc for a forward slash, but I'm wondering if RegExp searches is common enough that the closing forward slash can be assumed?

  2. The Find (mini) dialog is displayed over the first 3 lines or so of the document, so if the first hit on the search is in that code, it is highlighted, but you don't see it. This can be fixed if you're in the middle of the file by scrolling the page, but I am not sure how to fix the case that it's in the first 3 lines of the file.

@redmunds

Done with initial review.

@peterflynn
Adobe Systems Incorporated member
  1. Interesting point. We could assume that anything with a leading slash will be a regexp, but then do we assume the same thing when the search is finalized by pressing Enter? If so then we've changed the syntax (need to update the instructional label, etc.)... but if not, then there's an inconsistency between the search that runs as you type vs. when you hit Enter. I wonder if it's best to just wait until we have a better search UI (where presumably we'd have a RegExp toggle button/shortcut rather than a special syntax).

  2. The same bug exists before my pull request too. This is a general issue with how CodeMirror scrolls things into view (I see it all the time with Ctrl+T too). It's definitely annoying and I would love to fix it sometime soon, though :-)

@redmunds

Looks good. Merging.

@redmunds redmunds merged commit a5c0f96 into master Oct 12, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment