Skip to content

Heperowt/Text-Editor-Stack-Queue-Logic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✍️ Text Editor Logic (Stack & Queue Implementation)

C#

This project demonstrates the practical application of Stacks and Queues in a text editor environment. It features two modes: an interactive Stack-based editor and a command-processing Queue-based editor.

🚀 Features

1. Undo/Redo System (Stack-Based)

The interactive mode uses two stacks (undoStack and redoStack) to manage text states.

  • Write: Pushes the current state to the undoStack and updates the text.
  • Undo: Pops from undoStack, pushes current state to redoStack.
  • Redo: Pops from redoStack, pushes current state back to undoStack.

2. Command Processor (Queue-Based)

The non-interactive mode processes a string of commands sequentially using a Queue (FIFO).

  • w <word>: Writes a word.
  • u: Performs a simple undo (removes the last word).
  • s: Shows the current text.
  • Example Input: w Data w Structures u w Algorithm s

🧠 Why These Data Structures?

  • Stacks (LIFO): Perfect for Undo/Redo because we always want to access the last action performed.
  • Queues (FIFO): Ideal for command processing where commands must be executed in the exact order they were received.

🛠️ How to Run

  1. Clone the repository.
  2. Open the solution in Visual Studio.
  3. Choose mode 's' for interactive Stack editor or 'q' for command-based Queue editor.

About

A C# simulation of a text editor's core logic. It uses Stacks to implement Undo/Redo operations and a Queue to process sequential text commands.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages