Repository navigation
feat: show selected word count in status bar - #20
Conversation
|
Reviewed 357f47e. Found two issues to address:
Validation: typecheck and all 37 frontend tests pass. I reproduced the count discrepancies programmatically; the mode-switch issue was traced through the code, not tested in the UI. |
- Extract prose words ignoring Markdown syntax tokens so '# Title' is 2 words consistently in both total and selection counts - Exclude YAML frontmatter from selected word count in source mode - Reset selection word count when switching between rich text and source modes - Report initial selection on mount in MarkdownSourceEditor to avoid stale counts - Add unit tests for word counting and body selection extraction
|
Thanks for catching these! Both issues have been addressed in
Added 8 unit tests in |
|
Thanks for the fixes. The heading and frontmatter examples now count correctly, and the mode-switch reset is in place. I checked acd69c8 and found a few remaining cases:
Typecheck and all 45 frontend tests pass. I reproduced these cases programmatically with the editor libraries, not through the UI. Could you add coverage for these cases too? |
|
Thanks for catching those edge cases! All three have been addressed in
Added unit tests covering markdown tables (with and without borders), nested blockquotes, and post-indentation selection slicing. All 84 tests, typecheck ( |
|
Checked 2622f7b and confirmed the three previously reported cases are fixed. There’s still a mismatch when Markdown syntax is nested or appears as literal text:
I think the total and selection need to be counted from the same text representation, without running Markdown stripping on text that’s already been rendered. Could you cover these two cases as well? Typecheck and all 47 frontend tests pass. I reproduced the fixes and these remaining cases programmatically using the editor libraries, not through the UI. |
|
Thanks Saurabh, that makes total sense. You're completely right that running Markdown regex stripping on text that's already been rendered is the wrong model and caused the numerator and denominator to drift. Addressed in
Added unit test coverage for literal symbols in rendered prose counting ( |
|
Thanks, the previously reported examples now pass in f52b2b4. I found one remaining issue with how the total is set when loading notes: If source mode is already enabled when you open a note, the load handler still counts the rendered ProseMirror text. For a note containing The reload handler has a related issue: it reads Typecheck and all 48 frontend tests pass. I verified the counts programmatically and traced the load/reload behavior through the code; I haven’t tested these flows in the UI. |
|
Thanks for catching those lifecycle cases! Addressed in
All 87 frontend tests, TypeScript typecheck ( |
Summary
Displays real-time word count for highlighted/selected text in the status bar.
Details
X of Y words(e.g.14 of 350 words).Y wordscount.bunx tsc --noEmitpasses cleanly and all 59 Rust tests incargo testpass.