A powerful and efficient text editor implemented in C++, utilizing the Rope data structure for optimal text manipulation.
- Rope Data Structure: Efficient for large text documents
- Cursor Navigation: Move cursor up, down, left, and right with preferred column feature
- Text Manipulation: Insert, delete, and replace text
- Undo/Redo: Full support for undoing and redoing actions
- File Operations: Open and save files
- Search Functionality: Find text within the document
- Command-Line Interface: Easy-to-use commands for all operations
- C++ compiler with C++11 support or later
- Make (optional, for building)
-
Clone the repository:
git clone https://github.com/yourusername/cpp-text-editor.git cd cpp-text-editor -
Compile the project:
g++ -std=c++11 -o text_editor main.cpp text_editor.cpp
Run the compiled executable:
./text_editor
Once the editor is running, you can use the following commands:
i <text>- Insert text at cursord <n>- Delete n characters from cursorm <row> <col>- Move cursor to specified positiong <line>- Go to specified linep- Print current textu- Undo last actionr- Redo last undone actionf <text>- Find text in the documents <old> <new>- Replace texto <filename>- Open filew <filename>- Write to fileq- Quit the editorh- Show help menu
The editor uses a Rope data structure to store and manipulate text efficiently. This allows for faster insertion and deletion operations, especially for large documents.
The Cursor class manages the current position within the text, supporting movement in all directions and maintaining a preferred column for vertical movement.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE.md file for details.
- Thanks to all contributors who have helped with this project.
- Inspired by classic text editors and modern data structures.