TextEditor
A GUI plaintext editor written in Java Swing, optimized with a Rope data structure (based on Treap) for O(log n) text operations. Features include comprehensive file operations (open, save, auto-save), multi-tab editing, KMP-based pattern search, real-time spell checking using dynamic programming and Trie data structures.
Install / Use
/learn @Abdelrhmansersawy/TextEditorREADME
TextEditor
A feature-rich GUI plaintext editor written in Java Swing.
Table of Contents
Features
- Create, open, and save plain text documents
- Multi-tab support
- Undo/redo functionality
- Find and replace capabilities
- Auto-save functionality
Installation & Usage
Ensure you have Java Development Kit (JDK) installed
Create output directory and compile
mkdir -p out && javac -cp "library/*:src" src/**/*.java -d out
Run the application
java -cp "out:library/*" Main
Core Features
File Operations
<details> <summary>Create, Open, and Save Documents</summary>-
Open files using the "Open" menu item and select through the file chooser dialog
-
Save files using the "Save" menu item with automatic overwrite protection
</details>

Work with multiple documents simultaneously

Advanced Features
Spell Checker
Creating a smart spell-checking system that suggests corrections in real-time as you type. Here’s how it works: Dictionary Management:
-
The system starts by loading a list of words from a dictionary file. If the file isn’t available, it uses a basic set of common words.
-
As you type new words, the system "learns" them and adds them to the dictionary, making it smarter over time. Suggestions:
-
If you misspell a word, the system suggests up to 7 possible corrections based on how close the word is to others in the dictionary.
You can load any dictionary file, for me I used this one 10000 English word
Here's the guide to activiate it
-
Download google-10000-english.txt
-
Move it to your project directory and put it into /library/
- Implements KMP string pattern search algorithm (O(n + m) complexity)
- Supports both single and bulk replacements
Performance Comparison:
| Operation | Brute force | KMP |
| ---- | ---- | ---- |
| search | O(n * m) | O(n+m) |

Automatically tracks and saves changes

Technical Implementation
Undo/Redo System
- Implemented using Command Pattern design pattern
- Utilizes Stack and Rope data structures

Rope Data Structure
A specialized data structure for efficient string manipulation with O(log n) operations.
[!NOTE] The Rope data structure implementation is based on Treap data structure for balanced operations.
Implementation Details
- Based on Treap (Balanced Binary Search Tree)
- Uses randomization and Binary Heap properties
Performance Comparison: | Operation | Vector/String | Rope | | ---- | ---- | ---- | | Build | O(n) | O(n log n) | | Insert | O(n m) | O(m log n) | | Erase | O(n) | O(log n) | | Concat | O(m) | O(log n) |
How to Contribute
- Fork the repository
- Create a new branch (
git checkout -b feature/AmazingFeature) - Make your changes
- Run tests if available
- Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Create a Pull Request
Related Skills
node-connect
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
