Commit 5f9fb1a
fix: connect contentsChanged for char count, use characterCount() for performance
- Add document().contentsChanged connection so char count updates on Delete/Backspace
even when cursor position does not move (stale-count bug)
- Replace toPlainText() with document().characterCount() - 1 in _update_cursor_label
to avoid full string allocation on every keypress (190x faster)
- Strengthen "5" assertion to "5 chars" in test_cursor_label_shows_char_count
- Add test_char_count_updates_on_delete_without_cursor_move covering the stale-count scenario
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent e2b6e7d commit 5f9fb1a
2 files changed
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
248 | 251 | | |
249 | 252 | | |
250 | 253 | | |
| |||
390 | 393 | | |
391 | 394 | | |
392 | 395 | | |
393 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
394 | 400 | | |
395 | 401 | | |
396 | 402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | | - | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
0 commit comments