Skip to content

Commit 1f35bfc

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 f5eb673 commit 1f35bfc

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

app/src/processing/app/EditorTab.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,8 @@ void handleSelectAll() {
518518
void handleCommentUncomment() {
519519
Action action = textarea.getActionMap().get(RSyntaxTextAreaEditorKit.rstaToggleCommentAction);
520520
action.actionPerformed(null);
521-
521+
// XXX: RSyntaxDocument doesn't fire DocumentListener events, it should be fixed in RSyntaxTextArea?
522+
editor.updateUndoRedoState();
522523
}
523524

524525
void handleDiscourseCopy() {
@@ -538,6 +539,8 @@ void handleIndentOutdent(boolean indent) {
538539
Action action = textarea.getActionMap().get(RSyntaxTextAreaEditorKit.rstaDecreaseIndentAction);
539540
action.actionPerformed(null);
540541
}
542+
// XXX: RSyntaxDocument doesn't fire DocumentListener events, it should be fixed in RSyntaxTextArea?
543+
editor.updateUndoRedoState();
541544
}
542545

543546
void handleUndo() {

app/test/processing/app/BlockCommentGeneratesOneUndoActionTest.java

+13-1
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)