1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Autoformat was generating two undo action, the first one being an empty editor. Tested and fixed

This commit is contained in:
Federico Fissore
2015-04-27 18:47:47 +02:00
parent c0a1ffa27a
commit f8aecd0f9c
2 changed files with 58 additions and 0 deletions

View File

@ -92,8 +92,10 @@ public class AStyle implements Tool {
int line = getLineOfOffset(textArea);
int lineOffset = getLineOffset(textArea, line);
editor.getTextArea().getUndoManager().beginInternalAtomicEdit();
editor.setText(formattedText);
editor.getSketch().setModified(true);
editor.getTextArea().getUndoManager().endInternalAtomicEdit();
if (line != -1 && lineOffset != -1) {
setCaretPosition(textArea, line, lineOffset);