Add braille text wrap modes with continuation marks#20146
Draft
LeonarddeR wants to merge 1 commit into
Draft
Conversation
12 tasks
f9ebc30 to
e142dde
Compare
Replaces boolean wordWrap config with BrailleTextWrapFlag feature flag (NONE, MARK_WORD_CUTS, AT_WORD_BOUNDARIES, AT_WORD_OR_SYLLABLE_BOUNDARIES). Adds profile upgrade step v22->v23, deprecated API bridge, GUI combo box, continuation mark (dots 7-8) when a word is cut mid-display, and _continuationRows tracking in BrailleBuffer. Syllable boundary mode is wired but its backend follows in a separate PR.
f040151 to
e080142
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Part of #17010. Split out from #19916 at reviewer request — this is the second of three PRs. The pyphen abstraction layer was shipped in #20145; the syllable-aware wrap mode follows in a separate PR.
Summary of the issue:
The braille word-wrap setting is a single boolean that gives users no control over how words are broken at the display edge. When a word is cut mid-way there is also no visual indication that the word continues on the next row.
Description of user facing changes:
The boolean "word wrap" checkbox in the braille settings has been replaced with a Text wrap combo box with three choices:
Existing user profiles with the old
wordWrap = True/wordWrap = Falsesetting are automatically upgraded:Truebecomes "At word boundaries" andFalsebecomes "Off".Description of developer facing changes:
BrailleTextWrapFlagfeature flag enum added toconfig.featureFlagEnumswith membersDEFAULT,NONE,MARK_WORD_CUTS,AT_WORD_BOUNDARIES.wordWrapboolean is deprecated and bridged bidirectionally totextWrapvia_linkDeprecatedValues, so add-ons reading or writing the old key keep working (with a deprecation warning).CONTINUATION_SHAPE = 0xC0(dots 7-8) constant added tobraille.Description of development approach:
The continuation mark is unified: it consistently means "a word was cut here" regardless of mode, so readers get a predictable signal.
BrailleBuffer._calculateWindowRowBufferOffsetsis extended to implement all three modes.BrailleBuffer._get_windowBrailleCellsinserts the continuation mark into rows flagged in_continuationRows.BrailleBuffer._set_windowEndPosshort-circuits space-seeking forNONEandMARK_WORD_CUTSmodes (backwards scroll alignment).Testing strategy:
Unit tests cover:
_calculateWindowRowBufferOffsets(no cells, fits exactly, word cut, word too long for display, no space on line)._get_windowBrailleCells.wordWrap = True/False→ correcttextWrapflag values.Manual testing: loaded a pre-upgrade profile with
wordWrap = True/Falseand confirmed the upgrade writes the expectedtextWrapvalue and the braille settings panel shows the matching label.Known issues with pull request:
None.
Code Review Checklist: