From 5cf2cf24e36cbadbe16fa2a667cf450829ccc306 Mon Sep 17 00:00:00 2001 From: Rustam Vishnyakov Date: Thu, 20 Oct 2016 21:20:22 +0300 Subject: [PATCH] A fix for IDEA-162922 Enter action produces 2 undo operations --- .../codeInsight/editorActions/BaseEnterHandler.java | 2 +- .../codeStyle/lineIndent/FormatterBasedIndentAdjuster.java | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/BaseEnterHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/BaseEnterHandler.java index cbb701d8075c..c1971199c6c7 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/BaseEnterHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/BaseEnterHandler.java @@ -21,7 +21,7 @@ import com.intellij.openapi.editor.actionSystem.DocCommandGroupId; import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler; public abstract class BaseEnterHandler extends EditorWriteActionHandler { - private static final String GROUP_ID = "EnterHandler.GROUP_ID"; + public static final String GROUP_ID = "EnterHandler.GROUP_ID"; protected BaseEnterHandler() { super(false); diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/lineIndent/FormatterBasedIndentAdjuster.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/lineIndent/FormatterBasedIndentAdjuster.java index d800750409d6..cbd8da60ab39 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/lineIndent/FormatterBasedIndentAdjuster.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/lineIndent/FormatterBasedIndentAdjuster.java @@ -25,8 +25,6 @@ import org.jetbrains.annotations.NotNull; public class FormatterBasedIndentAdjuster { - private static final String ADJUST_INDENT_COMMAND_NAME = "Adjust Indent"; - private FormatterBasedIndentAdjuster() { } @@ -57,10 +55,10 @@ public class FormatterBasedIndentAdjuster { public void run() { int lineStart = myDocument.getLineStartOffset(myLine); - CommandProcessor.getInstance().executeCommand(myProject, () -> + CommandProcessor.getInstance().runUndoTransparentAction(() -> ApplicationManager.getApplication().runWriteAction(() -> { CodeStyleManager.getInstance(myProject).adjustLineIndent(myDocument, lineStart); - }), ADJUST_INDENT_COMMAND_NAME, null); + })); } }