maerkdown: the style row shows which toggles are armed - #21
Open
nicolas-maman wants to merge 1 commit into
Open
Conversation
Ctrl+B (or the B button) armed bold, but nothing on screen said so: `pend` was only visible in the debug caret line, so a toggle gave no feedback until the next word was typed. The eight style buttons now carry an accent while armed and the theme's plate colour while idle, seeded once at startup so the row does not jump from native to plated on the first edit. `pend` stays the single source of truth. sync_toolbar re-reads it from publish, which every edit already funnels through, rather than latching on click. That matters because commit_word clears pend after XORing it into the word, so a latched button would stay lit over a word that is no longer being styled. Colour rather than a label marker deliberately: the labels are how the UI driver and screen readers address these buttons (widget_id_of matches text exactly), so a label that changed with state would make them unaddressable.
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.
Ctrl+B armed bold, but nothing on screen said so.
pendwas only visible in the debug caret line, so pressing B or Ctrl+B gave no feedback until you typed the next word.The eight style buttons now carry an accent while armed and the theme's plate colour while idle, seeded once at startup so the row does not jump from native to plated on the first edit.
Why it re-reads rather than latches
pendstays the single source of truth.sync_toolbarre-reads it frompublish, which every edit already funnels through. A button that latched on click would stay lit aftercommit_wordclearspend, i.e. lit over a word that is no longer being styled. Re-reading also means the Ctrl+B/I/U shortcuts light the row for free, since they go through the sametoggle_flag.Why colour and not a label marker
I tried the label first (
[B]when armed) and backed it out.widget_id_ofmatches widget text exactly, so the spec suite addresses these buttons as"B","U","Mark","Sup","Sub". A label that changed with state would make them unaddressable mid-run, and would read oddly to a screen reader too. Colour leaves the labels alone.Idle colour follows
is_dark_mode(), so the plate suits either desktop theme.Testing
Driven end to end through the UI driver on macOS:
#3d77c6, the other seven stay on the idle platependclears, which is the case a latching implementation would get wrongBuilds clean with no new warnings (13 W1001 before and after, all pre-existing).
test_mdownpasses.One caveat: I could not run
spec_maerkdownlocally, it fails to compile against my aeocha checkout with'expect_http_post_ok' is not exported from module 'aeocha'. That failure reproduces identically on unmodifiedmain, so it is a stale local checkout rather than anything in this branch, but it does mean the spec has not been run against this change here. Worth a CI look.Edgains nine fields (eight handles plus the theme flag), so its allocation goes 104 to 176 bytes.