This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
For #6093: Added button to show all results in a list #6099
Closed
+45
−11
Closed
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0388f9c
Added button to show all results in a list
43cb09c
UI changes
44f1ec9
Cursor, title, shortcut
ca708e0
Merge master
df324c2
Fix merge errors
8128171
Code review changes
9bba693
Merge remote-tracking branch 'upstream/master' into find-all-in-file-…
220f51a
Code review changes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,7 +276,9 @@ define(function (require, exports, module) { | |
|
||
function indicateHasMatches(numResults) { | ||
// Make the field red if it's not blank and it has no matches (which also covers invalid regexes) | ||
ViewUtils.toggleClass($("#find-what"), "no-results", !state.foundAny && $("#find-what").val()); | ||
var query = $("#find-what").val(); | ||
ViewUtils.toggleClass($("#find-what, #find-counter"), "no-results", !state.foundAny && query); | ||
$("#find-counter").attr("title", (state.foundAny && query) ? Strings.FIND_SHOW_IN_LIST + " (" + KeyBindingManager.formatKeyDescriptor("Alt-Enter") + ")" : ""); | ||
|
||
// Buttons disabled if blank, OR if no matches (Replace buttons) / < 2 matches (nav buttons) | ||
$("#find-prev, #find-next").prop("disabled", !state.foundAny || numResults < 2); | ||
|
@@ -360,6 +362,19 @@ define(function (require, exports, module) { | |
} | ||
} | ||
|
||
/** | ||
* Shows the found results in a list (which is just the invoked FindInFiles panel) | ||
*/ | ||
function _showResultsInList() { | ||
if (!$("#find-counter").hasClass("no-results")) { | ||
var query = $("#find-what").val(); | ||
modalBar.close(true, true); | ||
CommandManager.execute(Commands.EDIT_FIND_IN_SUBTREE, DocumentManager.getCurrentDocument().file, query); | ||
return true; | ||
} | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure why we need a return for this function since is not used. But if we need it, you should add a |
||
} | ||
|
||
|
||
/** | ||
* Opens the search bar with the given HTML content (Find or Find-Replace), attaches common Find behaviors, | ||
|
@@ -413,9 +428,12 @@ define(function (require, exports, module) { | |
|
||
handleQueryChange(editor, state); | ||
}) | ||
.on("click", "#find-counter", _showResultsInList) | ||
.on("keydown", function (e) { | ||
if (e.keyCode === KeyEvent.DOM_VK_RETURN) { | ||
if (!e.shiftKey) { | ||
if (e.altKey) { | ||
_showResultsInList(); | ||
} else if (!e.shiftKey) { | ||
findNext(editor); | ||
} else { | ||
findNext(editor, true); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we should still use a variable for the string or at least split this into 2 lines.