diff options
| author | 2024-03-28 18:43:48 +0000 | |
|---|---|---|
| committer | 2024-03-28 18:43:48 +0000 | |
| commit | 1c3745cdf89ec4b171e3dd8bc8ccd97b0cd7dfcc (patch) | |
| tree | 957ee03ccb3a624ea7947358af82908b2f4196be /enigma-swing | |
| parent | Fix possible NPE in MappingIoConverter (diff) | |
| download | enigma-1c3745cdf89ec4b171e3dd8bc8ccd97b0cd7dfcc.tar.gz enigma-1c3745cdf89ec4b171e3dd8bc8ccd97b0cd7dfcc.tar.xz enigma-1c3745cdf89ec4b171e3dd8bc8ccd97b0cd7dfcc.zip | |
Clear undo history when updating editor text. (#540)
We don't care about the undo/redo history of the syntax pane, any change history would be stored separately
Diffstat (limited to 'enigma-swing')
| -rw-r--r-- | enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java index b285689e..e0a299f5 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java | |||
| @@ -35,6 +35,7 @@ import javax.swing.text.Document; | |||
| 35 | import javax.swing.text.Highlighter.HighlightPainter; | 35 | import javax.swing.text.Highlighter.HighlightPainter; |
| 36 | 36 | ||
| 37 | import de.sciss.syntaxpane.DefaultSyntaxKit; | 37 | import de.sciss.syntaxpane.DefaultSyntaxKit; |
| 38 | import de.sciss.syntaxpane.SyntaxDocument; | ||
| 38 | 39 | ||
| 39 | import cuchaz.enigma.EnigmaProject; | 40 | import cuchaz.enigma.EnigmaProject; |
| 40 | import cuchaz.enigma.analysis.EntryReference; | 41 | import cuchaz.enigma.analysis.EntryReference; |
| @@ -504,6 +505,11 @@ public class EditorPanel { | |||
| 504 | this.editor.getHighlighter().removeAllHighlights(); | 505 | this.editor.getHighlighter().removeAllHighlights(); |
| 505 | this.editor.setText(source.toString()); | 506 | this.editor.setText(source.toString()); |
| 506 | 507 | ||
| 508 | // We don't care about the undo/redo history of the syntax pane, any change history would be stored separately | ||
| 509 | if (this.editor.getDocument() instanceof SyntaxDocument syntaxDocument) { | ||
| 510 | syntaxDocument.clearUndos(); | ||
| 511 | } | ||
| 512 | |||
| 507 | if (this.source != null) { | 513 | if (this.source != null) { |
| 508 | this.editor.setCaretPosition(newCaretPos); | 514 | this.editor.setCaretPosition(newCaretPos); |
| 509 | } | 515 | } |