From fca8a760f5d58bd346763ac2524ef7fc6dc02555 Mon Sep 17 00:00:00 2001 From: Paul Kulchenko Date: Tue, 7 Apr 2015 22:32:41 -0700 Subject: [PATCH] Disabled replacing when search results are not modified (#416). --- src/editor/findreplace.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/editor/findreplace.lua b/src/editor/findreplace.lua index 90ee718331..333e7f3c21 100644 --- a/src/editor/findreplace.lua +++ b/src/editor/findreplace.lua @@ -1005,7 +1005,10 @@ local package = ide:AddPackage('core.findreplace', { end, onEditorPreSave = function(self, editor, filePath) - if editor == findReplace.reseditor and findReplace.reseditor.replace then + if editor ~= findReplace.reseditor then return end + + local isModified = ide:GetDocument(editor):IsModified() + if findReplace.reseditor.replace and isModified then findReplace:SetStatus("") local line = NOTFOUND @@ -1071,7 +1074,7 @@ local package = ide:AddPackage('core.findreplace', { -- don't offer to save file if called from SaveFile; -- can still be used with explicit SaveFileAs - elseif editor == findReplace.reseditor and not filePath then + elseif not filePath and not isModified then return false end end