Use before a manipulating text to group editing operations together as a single undo. Use stopCompoundEdit() once finished.
()
| 1752 | * as a single undo. Use stopCompoundEdit() once finished. |
| 1753 | */ |
| 1754 | public void startCompoundEdit() { |
| 1755 | // Call endTextEditHistory() before starting a new CompoundEdit, |
| 1756 | // because there's a timer that's possibly set off for 3 seconds after |
| 1757 | // which endTextEditHistory() is called, which means that things get |
| 1758 | // messed up. Hence, manually call this method so that auto-format gets |
| 1759 | // undone in one fell swoop if the user calls auto-formats within 3 |
| 1760 | // seconds of typing in the last character. Then start a new compound |
| 1761 | // edit so that the auto-format can be undone in one go. |
| 1762 | // https://github.com/processing/processing/issues/3003 |
| 1763 | endTextEditHistory(); // also calls stopCompoundEdit() |
| 1764 | |
| 1765 | //stopCompoundEdit(); |
| 1766 | compoundEdit = new CompoundEdit(); |
| 1767 | caretUndoStack.push(textarea.getCaretPosition()); |
| 1768 | caretRedoStack.clear(); |
| 1769 | } |
| 1770 | |
| 1771 | |
| 1772 | /** |
no test coverage detected