Skip to content

Commit 0c5adbf

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 6d7e6b8 commit 0c5adbf

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
@@ -54,6 +54,7 @@
5454
import org.fife.ui.rsyntaxtextarea.RSyntaxUtilities;
5555
import org.fife.ui.rtextarea.Gutter;
5656
import org.fife.ui.rtextarea.RTextScrollPane;
57+
import org.fife.ui.rtextarea.RUndoManager;
5758

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

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

115118
private RSyntaxDocument createDocument(String contents) {

0 commit comments

Comments
 (0)