A simple console-based text editor written in Java. Supports writing, deleting, undo, redo, and clearing all text using a custom stack implementation.
This project demonstrates:
-
Use of StringBuilder
-
Implementation of UNDO/REDO using two stacks
-
Basic command-driven interface
Managing state changes and reversing operations
π Features β Write Append new content to the text editor.
β Delete Remove text only from the end (suffix delete). The editor ensures the input matches the end of the current text.
β Undo Reverses the last operation: Undo write β removes appended text Undo delete β restores deleted text
β Redo Re-applies the last undone operation.
β Start Over Clears the entire text and resets history.
π§ Core Logic
The editor keeps track of operations in the form:
- "W" β write operations.
- "D" β delete operations
These are pushed into: a. UNDO stack β for undoing actions b. REDO stack β for reapplying undone actions
π Example Usage Current text is:
Choose action: Write, Delete, UNDO, REDO, Delete Everything
Write Insert the text: Hello
Current text is: Hello
Delete Insert the text: lo
Current text is: Hel
UNDO
Current text is: Hello
π Technologies Used
Java
Custom stack implementation
StringBuilder
π License
This project is free to use for learning, assignments, and personal projects.