diff --git a/app/src/processing/app/EditorTab.java b/app/src/processing/app/EditorTab.java index 7e84fa001..c2fdbb9b4 100644 --- a/app/src/processing/app/EditorTab.java +++ b/app/src/processing/app/EditorTab.java @@ -518,7 +518,8 @@ public class EditorTab extends JPanel implements SketchFile.TextStorage { void handleCommentUncomment() { Action action = textarea.getActionMap().get(RSyntaxTextAreaEditorKit.rstaToggleCommentAction); action.actionPerformed(null); - + // XXX: RSyntaxDocument doesn't fire DocumentListener events, it should be fixed in RSyntaxTextArea? + editor.updateUndoRedoState(); } void handleDiscourseCopy() { @@ -538,6 +539,8 @@ public class EditorTab extends JPanel implements SketchFile.TextStorage { Action action = textarea.getActionMap().get(RSyntaxTextAreaEditorKit.rstaDecreaseIndentAction); action.actionPerformed(null); } + // XXX: RSyntaxDocument doesn't fire DocumentListener events, it should be fixed in RSyntaxTextArea? + editor.updateUndoRedoState(); } void handleUndo() { diff --git a/app/test/processing/app/BlockCommentGeneratesOneUndoActionTest.java b/app/test/processing/app/BlockCommentGeneratesOneUndoActionTest.java index 1a213eb1e..860716077 100644 --- a/app/test/processing/app/BlockCommentGeneratesOneUndoActionTest.java +++ b/app/test/processing/app/BlockCommentGeneratesOneUndoActionTest.java @@ -53,12 +53,24 @@ public class BlockCommentGeneratesOneUndoActionTest extends AbstractGUITest { jEditTextArea.selectAll(); GuiActionRunner.execute(new GuiQuery() { - protected Frame executeInEDT() { window.getEditor().getCurrentTab().handleCommentUncomment(); return window.getEditor(); } + }); + menuEditUndo.requireEnabled(); + menuEditUndo.click(); + + assertEquals(previousText, jEditTextArea.getText()); + + menuEditUndo.requireDisabled(); + + GuiActionRunner.execute(new GuiQuery() { + protected Frame executeInEDT() { + window.getEditor().getCurrentTab().handleIndentOutdent(true); + return window.getEditor(); + } }); menuEditUndo.requireEnabled();