Fixed returning focus to the editor after find-in-files followed by page search (#416).

This commit is contained in:
Paul Kulchenko
2015-06-11 20:59:03 -07:00
parent 18d471be2c
commit 38c6cd28fa

View File

@@ -974,7 +974,7 @@ function findReplace:createPanel()
function(event)
event:Skip()
local ed = self:GetEditor()
if ed then
if ed and ed ~= self.oveditor then
self.backfocus = {
editor = ed,
position = (ed:GetSelectionStart() == ed:GetSelectionEnd()
@@ -1100,8 +1100,6 @@ function findReplace:Hide(restorepos)
local ctrl = self.panel:FindFocus()
if not ctrl or ctrl:GetParent():GetId() ~= self.panel:GetId() then
-- if focus outside of the search panel, do nothing
elseif self:IsPreview(self.reseditor) then -- there is a preview, go there
self.reseditor:SetFocus()
elseif self.backfocus and ide:IsValidCtrl(self.backfocus.editor) then
local editor = self.backfocus.editor
-- restore original position for Shift-Esc or failed search
@@ -1109,6 +1107,8 @@ function findReplace:Hide(restorepos)
editor:GotoPos(self.backfocus.position)
end
editor:SetFocus()
elseif self:IsPreview(self.reseditor) then -- there is a preview, go there
self.reseditor:SetFocus()
end
local mgr = ide:GetUIManager()