feat(editor): spellcheck posture toggle (#77)
CI / ci (push) Canceled after 0s

Neo triage input: continuous spell checking off by default, on when
asked — markdown on disk already carries the spelling; squiggles are
a presentation choice, per-launch with no persistence.

Edit ▸ Check Spelling While Typing binds AppGateState.spellChecking
and applies it to the live NSTextView in makeNSView/updateNSView.
Commands views take gate as a plain property — @Environment lookups
trap at launch there (crash-verified).

Verified in-app: toggle -> live view flag true -> squiggles render.
(The initial "does nothing" report was a machine-level kill switch:
NSAllowContinuousSpellChecking=0 in the global defaults domain, since
deleted; no app code change was needed for that part.)

Closes #77 follow-up.
This commit is contained in:
AlexKucera committed 2026-10-08 17:36:57 +02:00
1 parent 49fab56452
commit c1f5d707f8
4 files changed
+46 -4

No files matched your search

+25
View File
@@ -24,6 +24,10 @@ final class AppGateState {
let mentor = MentorSessionModel()
/// #18: the app-scoped Posts state — FSEvents watcher + lifecycle ops.
let posts = PostsModel()
/// #77 (Neo triage input): spellcheck posture — off by default, on when
/// asked via Edit ▸ Check Spelling While Typing. Per-launch only, no
/// persistence; markdown on disk already carries the spelling.
var spellChecking = false
/// #17: the Museion Home — repoint-only (ADR-0004). Defaults to
/// `~/Documents/Museion`; UserDefaults is the persistence floor: a Home is
/// a plain folder, nothing app-owned to put in a database. Non-file URLs
@@ -74,6 +78,12 @@ struct MuseionApp: App {
CommandGroup(replacing: .appInfo) {
OpenAboutButton()
}
// #77: spellcheck posture — Edit ▸ Check Spelling While Typing,
// default off (Neo posture: on when asked). Explicit rather than
// relying on the stock submenu's presence in a WindowGroup app.
CommandGroup(after: .textEditing) {
EditSpellingToggle(gate: gate)
}
// #68: View menu reading toggle — reaches the visible editor.
CommandMenu("View") {
Button("Toggle Reading Mode") {
@@ -98,6 +108,21 @@ private struct OpenAboutButton: View {
}
}
/// #77: the spellcheck posture toggle — binds the app-scoped bool the editor
/// surface reads on every update pass. Takes `gate` as a plain property:
/// commands views don't inherit the window environment (@Environment lookup
/// traps at launch — crash-verified), but observation tracking still works.
private struct EditSpellingToggle: View {
let gate: AppGateState
var body: some View {
Toggle("Check Spelling While Typing", isOn: Binding(
get: { gate.spellChecking },
set: { gate.spellChecking = $0 },
))
}
}
/// #50: reveals `~/Library/Application Support/Museion/Backups` in Finder —
/// restore is manual Finder copy-back in v1 (help doc describes it).
private struct OpenBackupFolderButton: View {