Skip to content

Commit 18a57c2

Browse files
committed
Fixed regression tests on Indent/Unindent and Comment/Uncomment actions
RSTA for some reason doesn't fire update signals on DocumentListeners.
1 parent 085ad97 commit 18a57c2

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

app/src/processing/app/EditorTab.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,8 @@ void handleSelectAll() {
492492
void handleCommentUncomment() {
493493
Action action = textarea.getActionMap().get(RSyntaxTextAreaEditorKit.rstaToggleCommentAction);
494494
action.actionPerformed(null);
495-
495+
// XXX: RSyntaxDocument doesn't fire DocumentListener events, it should be fixed in RSyntaxTextArea?
496+
editor.updateUndoRedoState();
496497
}
497498

498499
void handleDiscourseCopy() {
@@ -512,6 +513,8 @@ void handleIndentOutdent(boolean indent) {
512513
Action action = textarea.getActionMap().get(RSyntaxTextAreaEditorKit.rstaDecreaseIndentAction);
513514
action.actionPerformed(null);
514515
}
516+
// XXX: RSyntaxDocument doesn't fire DocumentListener events, it should be fixed in RSyntaxTextArea?
517+
editor.updateUndoRedoState();
515518
}
516519

517520
void handleUndo() {

app/test/processing/app/BlockCommentGeneratesOneUndoActionTest.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,24 @@ public void shouldUndoAndRedo() throws Exception {
5353
jEditTextArea.selectAll();
5454

5555
GuiActionRunner.execute(new GuiQuery<Frame>() {
56-
5756
protected Frame executeInEDT() {
5857
window.getEditor().getCurrentTab().handleCommentUncomment();
5958
return window.getEditor();
6059
}
60+
});
61+
62+
menuEditUndo.requireEnabled();
63+
menuEditUndo.click();
64+
65+
assertEquals(previousText, jEditTextArea.getText());
6166

67+
menuEditUndo.requireDisabled();
68+
69+
GuiActionRunner.execute(new GuiQuery<Frame>() {
70+
protected Frame executeInEDT() {
71+
window.getEditor().getCurrentTab().handleIndentOutdent(true);
72+
return window.getEditor();
73+
}
6274
});
6375

6476
menuEditUndo.requireEnabled();

0 commit comments

Comments
 (0)