Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/search/FindInFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ define(function (require, exports, module) {
/** @type {Panel} Bottom panel holding the search results. Initialized in htmlReady() */
var searchResultsPanel;

/** @type {Entry} the File selected on the initial search */
var selectedEntry;

/** @type {number} The index of the first result that is displayed */
var currentStart = 0;

Expand Down Expand Up @@ -260,9 +263,7 @@ define(function (require, exports, module) {
* Sorts the file keys to show the results from the selected file first and the rest sorted by path
*/
function _sortResultFiles() {
var selectedEntry = ProjectManager.getSelectedItem().fullPath;
searchFiles = Object.keys(searchResults);

searchFiles.sort(function (key1, key2) {
if (selectedEntry === key1) {
return -1;
Expand Down Expand Up @@ -935,7 +936,13 @@ define(function (require, exports, module) {
initialString = dialog.getDialogTextField().val();
dialog._close(true);
}


// Save the currently selected file's fullpath if there is one selected and if it is a file
var selectedItem = ProjectManager.getSelectedItem();
if (selectedItem && !selectedItem.isDirectory) {
selectedEntry = selectedItem.fullPath;
}

dialog = new FindInFilesDialog();
searchResults = {};
currentStart = 0;
Expand Down