From 7a6233aff165e8406be38aa6a5d3dc655ea73f5d Mon Sep 17 00:00:00 2001 From: Marcel Gerber Date: Thu, 31 Oct 2013 22:30:14 +0100 Subject: [PATCH] Set focus to input field when hitting Find In Files when it is already open --- src/search/FindInFiles.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/search/FindInFiles.js b/src/search/FindInFiles.js index dcb512ccc75..05d0612ae59 100644 --- a/src/search/FindInFiles.js +++ b/src/search/FindInFiles.js @@ -810,6 +810,13 @@ define(function (require, exports, module) { var currentEditor = EditorManager.getActiveEditor(), initialString = currentEditor && currentEditor.getSelectedText(); + if (dialog && !dialog.closed && dialog.hasOwnProperty("modalBar") && dialog.modalBar) { + // The modalBar was already up. When creating the new modalBar, copy the + // current query instead of using the passed-in selected text. + initialString = dialog.getDialogTextField().val(); + dialog.modalBar.close(true, false); + } + dialog = new FindInFilesDialog(); searchResults = {}; currentStart = 0;