This project is a simple command-line-based text editor written in C++. It allows basic text editing operations such as inserting, deleting, replacing, and moving lines. It also supports saving to and loading from .txt files, along with an undo feature for recent actions.
- Insert text into any line (including creating blank lines if needed)
- Delete a specific line
- Replace the content of a line
- Move one line's content to another position
- View the full content with page-wise navigation (10 lines per page)
- Save the current text to a
.txtfile - Open and load content from a
.txtfile - Undo the most recent changes
The editor uses a singly linked list to store each line of text as a node. All editing actions are tracked in a stack to enable undo operations. The user interacts through a menu-based system in the terminal.
When the program is run, a menu is displayed with options:
- Insert text into Line N
- Delete line N
- Move line N into line M
- Replace text in Line N
- Print all
- Save into a .txt file
- Undo
- Open a .txt file
- Print the next page 10.Print the previous page
- To save your text, choose option 6 and provide a filename (without the
.txtextension). The file will be saved in the same folder as the program. - To open an existing text file, choose option 8 and enter the name of the file (again, without
.txt). The contents will be loaded line-by-line into the editor.
Make sure you have a C++ compiler (like g++) installed. Then run the following commands in the terminal: