Commit b1b960d
committed
feat: Implement dual-cursor for Arabic/connected scripts
Implements Phase 4 of the dual-cursor system architecture.
This adds hierarchical dual-cursor rendering for Arabic text:
- Word-level block: Semi-transparent pink background covering entire connected word
- Character-level outline: White 1px outline on specific letter under cursor
Changes:
- Add CursorLayerType enum for different cursor rendering strategies
- Extend Piece class with layerType parameter
- Modify measureCursor() to return Piece[] for multi-layer rendering
- Add measureArabicDualCursor() function for dual-layer measurement
- Update CSS theme with Arabic-specific cursor styles
- Refine script detection to exclude only punctuation (not diacritics)
- Ensure spaces/whitespace always treated as word boundaries
- Fix neutral character detection: inherit script type but not special cursor
- Only show dual-cursor for connected words (2+ Arabic characters)
- Fix character positioning using coordsForChar for accurate RTL placement
Visual design:
- Focused Arabic (connected word): Semi-transparent pink word block + white char outline
- Focused Arabic (isolated char): Standard transparent cursor
- Focused Latin: Solid pink block with white text (opaque)
- Focused neutral (punctuation, numbers): Standard transparent cursor
- Unfocused: Pink outline for all (character outline hidden for Arabic)
Performance: Word boundary detection O(n) where n ≤ 100 characters
Tested: ✅ Dual-cursor renders correctly on Arabic connected words
Tested: ✅ Word boundaries respect punctuation and spaces
Tested: ✅ Navigation (hjkl) tracks correctly through Arabic words
Tested: ✅ Single isolated Arabic characters use standard cursor
Tested: ✅ Neutral characters (# punctuation) use standard cursor
Tested: ✅ Character outline positioned correctly within word block
Related to #2481 parent 640494a commit b1b960d
2 files changed
+21
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | | - | |
| 167 | + | |
169 | 168 | | |
170 | 169 | | |
171 | 170 | | |
172 | 171 | | |
173 | 172 | | |
174 | 173 | | |
175 | 174 | | |
176 | | - | |
| 175 | + | |
177 | 176 | | |
178 | 177 | | |
179 | 178 | | |
180 | 179 | | |
181 | | - | |
| 180 | + | |
| 181 | + | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
214 | 216 | | |
215 | 217 | | |
216 | 218 | | |
| |||
237 | 239 | | |
238 | 240 | | |
239 | 241 | | |
| 242 | + | |
| 243 | + | |
240 | 244 | | |
241 | 245 | | |
242 | | - | |
243 | | - | |
| 246 | + | |
| 247 | + | |
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
| |||
337 | 341 | | |
338 | 342 | | |
339 | 343 | | |
| 344 | + | |
| 345 | + | |
340 | 346 | | |
341 | 347 | | |
342 | 348 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
| 173 | + | |
173 | 174 | | |
174 | 175 | | |
175 | 176 | | |
| |||
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
185 | | - | |
| 186 | + | |
| 187 | + | |
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
192 | | - | |
193 | | - | |
| 194 | + | |
| 195 | + | |
194 | 196 | | |
195 | 197 | | |
196 | 198 | | |
| |||
0 commit comments