Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ TextEditor β€” Java Console-Based Editor with Undo/Redo

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:

  1. Use of StringBuilder

  2. Implementation of UNDO/REDO using two stacks

  3. 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:

  1. "W" β€” write operations.
  2. "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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages