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

Commit

Permalink
Omit deleted files from find in files results.
Browse files Browse the repository at this point in the history
  • Loading branch information
gruehle committed May 17, 2013
1 parent 3fa4049 commit 0a02712
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/document/DocumentManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ define(function (require, exports, module) {
*/
function notifyFileDeleted(file, skipAutoSelect) {
// First ensure it's not currentDocument, and remove from working set
closeFullEditor(file);
closeFullEditor(file, skipAutoSelect);

// Notify all other editors to close as well
var doc = getOpenDocumentForPath(file.fullPath);
Expand Down
14 changes: 14 additions & 0 deletions src/search/FindInFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ define(function (require, exports, module) {
DocumentManager = require("document/DocumentManager"),
EditorManager = require("editor/EditorManager"),
FileIndexManager = require("project/FileIndexManager"),
FileUtils = require("file/FileUtils"),
KeyEvent = require("utils/KeyEvent"),
AppInit = require("utils/AppInit"),
StatusBar = require("widgets/StatusBar"),
Expand Down Expand Up @@ -455,8 +456,21 @@ define(function (require, exports, module) {
_showSearchResults(searchResults, currentQuery, currentScope);
}
}

function _pathDeletedHandler(event, path) {
if ($searchResultsDiv.is(":visible")) {
// Update the search results
searchResults.forEach(function (item, idx) {
if (FileUtils.isAffectedWhenRenaming(item.fullPath, path)) {
searchResults.splice(idx, 1);
}
});
_showSearchResults(searchResults, currentQuery, currentScope);
}
}

$(DocumentManager).on("fileNameChange", _fileNameChangeHandler);
$(DocumentManager).on("pathDeleted", _pathDeletedHandler);
$(ProjectManager).on("beforeProjectClose", _hideSearchResults);

CommandManager.register(Strings.CMD_FIND_IN_FILES, Commands.EDIT_FIND_IN_FILES, doFindInFiles);
Expand Down

0 comments on commit 0a02712

Please sign in to comment.