Skip to content

Commit 902bdfd

Browse files
TOMERGE: Fix undo menu items
Turns out I dropped a setUndoManager call somewhere, as well typed Redo instead of Undo somewhere.
1 parent 634e1ef commit 902bdfd

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

app/src/processing/app/Editor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,7 @@ public UndoAction() {
14961496

14971497
public void actionPerformed(ActionEvent e) {
14981498
try {
1499-
getCurrentTab().handleRedo();
1499+
getCurrentTab().handleUndo();
15001500
} catch (CannotUndoException ex) {
15011501
//System.out.println("Unable to undo: " + ex);
15021502
//ex.printStackTrace();

app/src/processing/app/EditorTab.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import org.fife.ui.rsyntaxtextarea.RSyntaxUtilities;
5454
import org.fife.ui.rtextarea.Gutter;
5555
import org.fife.ui.rtextarea.RTextScrollPane;
56+
import org.fife.ui.rtextarea.RUndoManager;
5657

5758
import processing.app.helpers.DocumentTextChangeListener;
5859
import processing.app.syntax.ArduinoTokenMakerFactory;
@@ -107,8 +108,10 @@ public EditorTab(Editor editor, SketchFile file, String contents)
107108
applyPreferences();
108109
add(this.scrollPane, BorderLayout.CENTER);
109110

110-
UndoManager undo = new LastUndoableEditAwareUndoManager(this.textarea, this.editor);
111-
((RSyntaxDocument)textarea.getDocument()).addUndoableEditListener(undo);
111+
RUndoManager undo = new LastUndoableEditAwareUndoManager(this.textarea,
112+
this.editor);
113+
document.addUndoableEditListener(undo);
114+
textarea.setUndoManager(undo);
112115
}
113116

114117
private RSyntaxDocument createDocument(String contents) {

0 commit comments

Comments
 (0)