From a8c8df6d643e297f0bcb97ba43eed24e4f4ea1cc Mon Sep 17 00:00:00 2001 From: "andrey.zaytsev" Date: Thu, 3 Nov 2011 02:11:34 +0300 Subject: [PATCH] WI-8102 replace all in selection should not deselect block --- platform/lang-impl/src/com/intellij/find/FindUtil.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/find/FindUtil.java b/platform/lang-impl/src/com/intellij/find/FindUtil.java index adcfc34745f6..a7016a210caa 100644 --- a/platform/lang-impl/src/com/intellij/find/FindUtil.java +++ b/platform/lang-impl/src/com/intellij/find/FindUtil.java @@ -475,10 +475,10 @@ public class FindUtil { return true; } - private static boolean doReplace(Project project, final Editor editor, FindModel model, final Document document, int caretOffset, + private static boolean doReplace(Project project, final Editor editor, final FindModel aModel, final Document document, int caretOffset, boolean toPrompt, ReplaceDelegate delegate) { FindManager findManager = FindManager.getInstance(project); - model = (FindModel)model.clone(); + final FindModel model = (FindModel)aModel.clone(); int occurrences = 0; List> rangesToChange = new ArrayList>(); @@ -588,7 +588,9 @@ public class FindUtil { public void run() { document.setText(newText); editor.getCaretModel().moveToOffset(finalCaretOffset); - editor.getSelectionModel().removeSelection(); + if (model.isGlobal()) { + editor.getSelectionModel().removeSelection(); + } } }); }