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.