feat(cold-turkey): the writing lock (#162)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
Wires #161's goal engine and #160's contract into the app: armed from a corner dot or View ▸ Start Cold Turkey…, enforced by the macOS app-kiosk (7-option presentation combo + fullscreen, restored on completion), readout with hairline + near-goal terracotta, and a completion note fading back into focus. While held: focus exit, reading, new buffers, ⌘W/⌃⌘F/⌘N refused (key-code-matched monitor — character matching is layout/Caps-blind; no .closeItem placement exists), ⌘Q asks once per #163's ruling. Typing continuity holds by construction — lock ⇒ focus freezes the branch under the editor and chrome mounts as overlays only. Arm values type directly (1…1000 words / 1…60 min, defaults 250/5). Nothing persists. Wayfinder map #158 Build S2; suite 620, flip-verified pins.
This commit is contained in:
1 parent
7b6abb5d65
commit
a9e199fce4
16 files changed
+1167
-19
No files matched your search
@@ -182,6 +182,8 @@ struct PostEditorView: View {
|
||||
focused: gate.isFocused,
|
||||
caretHint: flipBackCaret,
|
||||
dropBridge: gate.proseDrop,
|
||||
// #162: the Cold Turkey word feed.
|
||||
onTextChange: { gate.writingLock.feed(text: $0) },
|
||||
)
|
||||
} else {
|
||||
ProseTextView(
|
||||
@@ -194,6 +196,8 @@ struct PostEditorView: View {
|
||||
},
|
||||
caretHint: flipBackCaret,
|
||||
dropBridge: gate.proseDrop,
|
||||
// #162: the Cold Turkey word feed.
|
||||
onTextChange: { gate.writingLock.feed(text: $0) },
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -338,6 +342,10 @@ struct ProseTextView: NSViewRepresentable {
|
||||
var session: EditorSession?
|
||||
var draft: String?
|
||||
var onEdit: ((String) -> Void)?
|
||||
/// #162: the Cold Turkey feed — whole-document text on every edit,
|
||||
/// both modes (session + draft). No-op at rest; the lock's word
|
||||
/// count rides the same keystroke the editor already emits.
|
||||
var onTextChange: ((String) -> Void)?
|
||||
var spellChecking = false
|
||||
/// #21: focus mode — the text ground joins the workspace background.
|
||||
var focused = false
|
||||
@@ -357,11 +365,13 @@ struct ProseTextView: NSViewRepresentable {
|
||||
focused: Bool = false,
|
||||
caretHint: (location: Int, token: Int)? = nil,
|
||||
dropBridge: ProseDropBridge,
|
||||
onTextChange: ((String) -> Void)? = nil,
|
||||
) {
|
||||
self.session = session
|
||||
self.spellChecking = spellChecking
|
||||
self.focused = focused
|
||||
self.caretHint = caretHint
|
||||
self.onTextChange = onTextChange
|
||||
ingestFolder = session.postID != nil ? session.folderURL : nil
|
||||
self.dropBridge = dropBridge
|
||||
}
|
||||
@@ -373,12 +383,14 @@ struct ProseTextView: NSViewRepresentable {
|
||||
onEdit: @escaping (String) -> Void,
|
||||
caretHint: (location: Int, token: Int)? = nil,
|
||||
dropBridge: ProseDropBridge,
|
||||
onTextChange: ((String) -> Void)? = nil,
|
||||
) {
|
||||
self.draft = draft
|
||||
self.spellChecking = spellChecking
|
||||
self.focused = focused
|
||||
self.onEdit = onEdit
|
||||
self.caretHint = caretHint
|
||||
self.onTextChange = onTextChange
|
||||
self.dropBridge = dropBridge
|
||||
}
|
||||
|
||||
@@ -512,6 +524,8 @@ struct ProseTextView: NSViewRepresentable {
|
||||
|
||||
final class Coordinator: NSObject, NSTextViewDelegate {
|
||||
let onEdit: ((String) -> Void)?
|
||||
/// #162: the Cold Turkey feed (see the representable's property).
|
||||
let onTextChange: ((String) -> Void)?
|
||||
weak var textView: NSTextView?
|
||||
var sessionRef: EditorSession?
|
||||
var loadedGeneration = -1
|
||||
@@ -523,6 +537,7 @@ struct ProseTextView: NSViewRepresentable {
|
||||
|
||||
init(representable: ProseTextView) {
|
||||
onEdit = representable.onEdit
|
||||
onTextChange = representable.onTextChange
|
||||
}
|
||||
|
||||
func textDidChange(_ notification: Notification) {
|
||||
@@ -551,6 +566,8 @@ struct ProseTextView: NSViewRepresentable {
|
||||
} else {
|
||||
onEdit?(storage.string)
|
||||
}
|
||||
// #162: the lock's word count rides the same keystroke.
|
||||
onTextChange?(storage.string)
|
||||
// #115: fold maintenance LAST — hidden styling over the refreshed presentation.
|
||||
(tv as? ProseListTextView)?.refreshFolds()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user