Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Issue #8557 ("Over 100000 matches" when there are exactly 100000 matches) #9385

Merged
merged 5 commits into from
Oct 8, 2014

Conversation

jacksonweekes
Copy link
Contributor

Solves issue raised in #8557. Code passes all unit tests, and correctly shows results found below, at or above SearchModel.MAX_TOTAL_RESULTS.

@@ -157,6 +161,13 @@ define(function (require, exports, module) {
this.numMatches += resultInfo.matches.length;
if (this.numMatches >= SearchModel.MAX_TOTAL_RESULTS) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@jacksonweekes I think we can simply change the logic to this.numMatches > SearchModel.MAX_TOTAL_RESULTS so that it matches to the error message we're showing.

@peterflynn peterflynn changed the title Issue #8557 Issue #8557 ("Over 100000 matches" when there are exactly 100000 matches) Oct 1, 2014
@jacksonweekes
Copy link
Contributor Author

@RaymondLim That was my first thought(and I tried it) however it doesn't work for a couple of reasons. As I understand it(this is my first foray into Brackets and open source) FindInFiles.js passes the results to SearchModel.js, however FindInFiles only finds results up to MAX_TOTAL_RESULTS, which means that without the changes I have added to FindInFiles the condition this.numMatches > SearchModel.MAX_TOTAL_RESULTS never evaluates to true. With my changed FindInFiles it now returns up to MAX_TOTAL_RESULTS+1 which allows SearchModel to evaluate if there are additional results over MAX_TOTAL_RESULTS.
I have added the var excessMatches rather than using foundMaximum as foundMaximum can evaluate to true without there being excess matches. If I made the change you suggested then foundMaximum would only evaluate true if there were actually excess matches. As foundMaximum is tested elsewhere this may have unintended consequences.

@RaymondLim
Copy link
Contributor

@jacksonweekes Thanks for your detail explanation.

/**
* Clears out the model to an empty state.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you removing the existing comment for clear function below?

@jacksonweekes
Copy link
Contributor Author

@RaymondLim didn't realise I had done that, I have replaced that comment and fixed the file to conform to JSLint.

// Remove final result if there have been over MAX_TOTAL_RESULTS found
if (this.numMatches > SearchModel.MAX_TOTAL_RESULTS) {
this.results[fullpath].matches.pop();
this.numMatches -= 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

@jacksonweekes You can restore this line to this.numMatches--; since if you use Brackets folder (one level up from "src" folder) as your project root, then you won't get JSLint error on this line. We used to have /*jslint plusplus: true */ comment in most of the brackets source file, but files added lately no longer using it. Instead, .brackets.json file in Brackets folder has all the jslint options defined.

@jacksonweekes
Copy link
Contributor Author

@RaymondLim I have made the changes requested

@RaymondLim
Copy link
Contributor

Looks good. Merging.

RaymondLim added a commit that referenced this pull request Oct 8, 2014
Issue #8557 ("Over 100000 matches" when there are exactly 100000 matches)
@RaymondLim RaymondLim merged commit 6ad6834 into adobe:master Oct 8, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants