Add maximum line length option for screenreader accessibility#403
Add maximum line length option for screenreader accessibility#403vcaparica wants to merge 1 commit intotrypsynth:masterfrom
Conversation
Adds a configurable maximum line length setting to the Options dialog (Reading tab). When set, long lines are wrapped at word boundaries so screenreaders read manageable chunks instead of entire paragraphs at once. The default value of 0 preserves the current behavior (entire line). The wrapping replaces spaces with newlines, preserving character count so bookmarks, positions, and navigation remain accurate. Also sets explicit accessible names on all Options dialog controls to ensure screenreaders announce checkbox labels correctly.
|
Hi @vcaparica and thanks for the contribution! Can I ask what the use case of this feature is exactly? I'm happy to review and merge it even if I won't ever use it myself, Paperback is full of config options to make the widest array of users happy, but off the top of my head I'm struggling to come up with a use case for this. That said I primarily use Paperback to read nonfiction (e.g. programming textbooks, biographies, etc.), and I personally would never want the lines wrapped; I keep word wrap off too. Please just explain to me when you might use this feature, especially over traditional word wrap, and I'll gladly give the code a look. |
|
@trypsynth This can come in handy in cases where large paragraphs in Epub or DAISY books are presented on a single long line. This is oftentimes the case, and I myself sometimes struggle to move among sentences or phrases inside such paragraphs on a single line. |
|
What's wrong with the existing work wrap? |
|
That it doesn't work. It seems to do absolutely nothing for me (Windows 11, NVDA) with any of the documents I've tried reading in Paperback so far. It acts as though there was no word wrap at all, even if enabled. |
Summary
Technical Details
wrap_content()intext.rs: processes each paragraph independently, splitting at word boundaries. Words longer than the limit are kept intact (no mid-word truncation)apply_line_wrapping()indocument.rs: applies wrapping to the document buffer and rebuilds newline position trackingDocumentSession::new(), before the document handle is createdTest plan