diff --git a/java/java-tests/testData/find/findInEditor/SecondRegexReplaceShowsPopup.gold b/java/java-tests/testData/find/findInEditor/SecondRegexReplaceShowsPopup.gold new file mode 100644 index 000000000000..9e485a5de0b2 --- /dev/null +++ b/java/java-tests/testData/find/findInEditor/SecondRegexReplaceShowsPopup.gold @@ -0,0 +1,165 @@ +--- FIND MODEL --- +myStringToFind = +myStringToReplace = +isReplaceState =false +isWholeWordsOnly =false +searchContext =ANY +isFromCursor =true +isForward =true +isGlobal =true +isRegularExpressions =true +isCaseSensitive =false +isMultipleFiles =false +isPromptOnReplace =true +isReplaceAll =false +isOpenNewTab =false +isOpenInNewTabEnabled =false +isOpenNewTabVisible =false +isProjectScope =true +directoryName =null +isWithSubdirectories =true +fileFilter =null +moduleName =null +customScopeName =null +searchInProjectFiles =false + +-- + + aba +-- +------------ +--- FIND MODEL --- +myStringToFind =a +myStringToReplace = +isReplaceState =false +isWholeWordsOnly =false +searchContext =ANY +isFromCursor =true +isForward =true +isGlobal =true +isRegularExpressions =true +isCaseSensitive =false +isMultipleFiles =false +isPromptOnReplace =true +isReplaceAll =false +isOpenNewTab =false +isOpenInNewTabEnabled =false +isOpenNewTabVisible =false +isProjectScope =true +directoryName =null +isWithSubdirectories =true +fileFilter =null +moduleName =null +customScopeName =null +searchInProjectFiles =false + +-- + + [[]]b[a] +-- +RangeHighlighter: (1,2); layer:5999; tooltip: null : [java.awt.Color[r=0,g=0,b=0],java.awt.Color[r=255,g=255,b=0],0,BOXED,null,java.awt.Color[r=113,g=179,b=98]] +RangeHighlighter: (1,2); layer:5999; tooltip: null : [null,null,0,ROUNDED_BOX,java.awt.Color[r=0,g=0,b=0],null] +RangeHighlighter: (3,4); layer:5999; tooltip: null : [java.awt.Color[r=0,g=0,b=0],java.awt.Color[r=255,g=255,b=0],0,BOXED,null,java.awt.Color[r=113,g=179,b=98]] +------------ +--- FIND MODEL --- +myStringToFind =a +myStringToReplace =c +isReplaceState =false +isWholeWordsOnly =false +searchContext =ANY +isFromCursor =true +isForward =true +isGlobal =true +isRegularExpressions =true +isCaseSensitive =false +isMultipleFiles =false +isPromptOnReplace =true +isReplaceAll =false +isOpenNewTab =false +isOpenInNewTabEnabled =false +isOpenNewTabVisible =false +isProjectScope =true +directoryName =null +isWithSubdirectories =true +fileFilter =null +moduleName =null +customScopeName =null +searchInProjectFiles =false + +-- + + [[]]b[a] +-- +RangeHighlighter: (1,2); layer:5999; tooltip: null : [java.awt.Color[r=0,g=0,b=0],java.awt.Color[r=255,g=255,b=0],0,BOXED,null,java.awt.Color[r=113,g=179,b=98]] +RangeHighlighter: (1,2); layer:5999; tooltip: null : [null,null,0,ROUNDED_BOX,java.awt.Color[r=0,g=0,b=0],null] +RangeHighlighter: (3,4); layer:5999; tooltip: null : [java.awt.Color[r=0,g=0,b=0],java.awt.Color[r=255,g=255,b=0],0,BOXED,null,java.awt.Color[r=113,g=179,b=98]] +------------ +--- FIND MODEL --- +myStringToFind =a +myStringToReplace =c +isReplaceState =true +isWholeWordsOnly =false +searchContext =ANY +isFromCursor =true +isForward =true +isGlobal =true +isRegularExpressions =true +isCaseSensitive =false +isMultipleFiles =false +isPromptOnReplace =true +isReplaceAll =false +isOpenNewTab =false +isOpenInNewTabEnabled =false +isOpenNewTabVisible =false +isProjectScope =true +directoryName =null +isWithSubdirectories =true +fileFilter =null +moduleName =null +customScopeName =null +searchInProjectFiles =false + +-- +Replacement Preview: c +-- + + [[]]b[a] +-- +RangeHighlighter: (1,2); layer:5999; tooltip: null : [java.awt.Color[r=0,g=0,b=0],java.awt.Color[r=255,g=255,b=0],0,BOXED,null,java.awt.Color[r=113,g=179,b=98]] +RangeHighlighter: (1,2); layer:5999; tooltip: null : [null,null,0,ROUNDED_BOX,java.awt.Color[r=0,g=0,b=0],null] +RangeHighlighter: (3,4); layer:5999; tooltip: null : [java.awt.Color[r=0,g=0,b=0],java.awt.Color[r=255,g=255,b=0],0,BOXED,null,java.awt.Color[r=113,g=179,b=98]] +------------ +--- FIND MODEL --- +myStringToFind =a +myStringToReplace =c +isReplaceState =true +isWholeWordsOnly =false +searchContext =ANY +isFromCursor =true +isForward =true +isGlobal =true +isRegularExpressions =true +isCaseSensitive =false +isMultipleFiles =false +isPromptOnReplace =true +isReplaceAll =false +isOpenNewTab =false +isOpenInNewTabEnabled =false +isOpenNewTabVisible =false +isProjectScope =true +directoryName =null +isWithSubdirectories =true +fileFilter =null +moduleName =null +customScopeName =null +searchInProjectFiles =false + +-- +Replacement Preview: c +-- + + cb[[]] +-- +RangeHighlighter: (3,4); layer:5999; tooltip: null : [java.awt.Color[r=0,g=0,b=0],java.awt.Color[r=255,g=255,b=0],0,BOXED,null,java.awt.Color[r=113,g=179,b=98]] +RangeHighlighter: (3,4); layer:5999; tooltip: null : [null,null,0,ROUNDED_BOX,java.awt.Color[r=0,g=0,b=0],null] +------------ \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/find/FindInEditorTest.java b/java/java-tests/testSrc/com/intellij/find/FindInEditorTest.java index 07422f965753..6a469b3b3260 100644 --- a/java/java-tests/testSrc/com/intellij/find/FindInEditorTest.java +++ b/java/java-tests/testSrc/com/intellij/find/FindInEditorTest.java @@ -92,6 +92,17 @@ public class FindInEditorTest extends LightCodeInsightTestCase { checkResultByText("a b b a"); } + public void testSecondRegexReplaceShowsPopup() throws Exception { + configureFromText(" aba"); + initFind(); + myFindModel.setRegularExpressions(true); + myFindModel.setStringToFind("a"); + myFindModel.setStringToReplace("c"); + myFindModel.setReplaceState(true); + myLivePreviewController.performReplace(); + checkResults(); + } + private static void invokeFind() { executeAction(IdeActions.ACTION_FIND); UIUtil.dispatchAllInvocationEvents(); diff --git a/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java b/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java index 3824a900ab75..fe36bc0d003d 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java +++ b/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java @@ -327,6 +327,7 @@ public class SearchResults implements DocumentListener { Collections.sort(myOccurrences, (findResult, findResult1) -> findResult.getStartOffset() - findResult1.getStartOffset()); myFindModel = findModel; + myDocumentTimestamp = myEditor.getDocument().getModificationStamp(); updateCursor(oldCursorRange, next); updateExcluded(); notifyChanged(); @@ -337,7 +338,6 @@ public class SearchResults implements DocumentListener { notifyCursorMoved(); } dumpIfNeeded(); - myDocumentTimestamp = myEditor.getDocument().getModificationStamp(); } private void dumpIfNeeded() {