A custom, lightweight text editor built from scratch in C++23 using Raylib. The project demonstrates custom implementations of essential computer science data structures (Trie, Gap Buffer, and Min-Heap) to deliver real-time fuzzy text completion and efficient text manipulation.
- Real-Time Autocomplete & Spell-Checking: Dynamically suggests word completions as you type using Levenshtein edit distance logic.
- Custom Gap Buffer Implementation: Fast localized insertion and deletion operations around the cursor.
- Custom Trie Dictionary: Fast prefix lookups and fuzzy searches using custom C++ ranges-compatible iterators.
- Custom Min-Heap: Efficiently prioritizes and retrieves top dictionary suggestions based on edit costs.
- Rich Keyboard Shortcuts & Controls:
Up/DownArrows: Navigate popup suggestions or move text line-by-line.Enter: Select and insert highlighted suggestion (or insert a newline when no suggestion is active).Ctrl+Backspace: Delete whole word blocks.Ctrl+Left/Right: Jump across entire word blocks.Ctrl+Mouse Wheel/Numpad + / -: Scale rendering font size dynamically.Ctrl+V: Clipboard insertion directly into the gap buffer.
| Structure | File | Description |
|---|---|---|
| Trie | Node-based prefix tree acting as the primary dictionary database. Features a custom DFS Levenshtein distance search (searchImpl) and PreOrderIterator satisfying std::input_or_output_iterator. |
|
| Gap Buffer | High-performance text buffer handling insertion, deletion, and cursor movements by managing an internal dynamic "gap" region with a custom contiguous-like iterator. | |
| Min-Heap | Array-based min-heap tournament structure used for ranking search results by edit distance. | |
| Text Editor & GUI | Raylib-powered rendering pipeline handling fonts, line wrapping, cursor blinking, and context popup positioning. |
- Compiler: Modern C++ compiler supporting C++23 (GCC 13+, Clang 16+, or MSVC 2022+).
- Build System: CMake version 3.15 or higher.
- Internet Connection: Required on the initial CMake run to automatically download Raylib 5.0 via
FetchContent.
Before running the application, ensure the following asset files are present in the project folder or executable working directory:
rijeci.txt– Dictionary text file containing list of words for the Trie lookup.IntelOneMono-Regular.ttf– TTF font file for text rendering.
-
Clone the repository:
bash git clone git@github.com:Sebo1411/spellchecker.git cd spellchecker
-
Configure with CMake:
mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release
-
Compile: cmake --build .
-
Run: ./seminar