Use before a manipulating text to group editing operations together as a single undo. Use stopCompoundEdit() once finished.
()
| 1491 | * as a single undo. Use stopCompoundEdit() once finished. |
| 1492 | */ |
| 1493 | public void startCompoundEdit() { |
| 1494 | // Call endTextEditHistory() before starting a new CompoundEdit, |
| 1495 | // because there's a timer that's possibly set off for 3 seconds after |
| 1496 | // which endTextEditHistory() is called, which means that things get |
| 1497 | // messed up. Hence, manually call this method so that auto-format gets |
| 1498 | // undone in one fell swoop if the user calls auto-formats within 3 |
| 1499 | // seconds of typing in the last character. Then start a new compound |
| 1500 | // edit so that the auto-format can be undone in one go. |
| 1501 | // https://github.com/processing/processing/issues/3003 |
| 1502 | endTextEditHistory(); // also calls stopCompoundEdit() |
| 1503 | |
| 1504 | //stopCompoundEdit(); |
| 1505 | compoundEdit = new CompoundEdit(); |
| 1506 | caretUndoStack.push(textarea.getCaretPosition()); |
| 1507 | caretRedoStack.clear(); |
| 1508 | } |
| 1509 | |
| 1510 | |
| 1511 | /** |
no test coverage detected