Lock, not pin: the flag that keeps the model from rewriting a node
The badge reads LOCKED, the status line and messages say lock and unlock, p's help says what it is and that it is not P, and the cascade says a locked node was flagged, not rewritten. Pin now means only a pane's pin. The stored flag and the op API keep the old name, pinned, so a live library keeps its locks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
1 parent
edc31aac9a
commit
abf79c14cc
8 files changed
+21
-18
No files matched your search
+1
-1
@@ -391,7 +391,7 @@ function StatusLine() {
|
||||
: "Enter open/enter · e toggle · D delete note · w link it"
|
||||
: `e expand${store.generating ? "" : " (no model)"} · d define · y why · x example · c challenge · : ask · w link`
|
||||
: st.up || st.down
|
||||
? `stale · ${n.pinned ? "b accept · p unpin" : "R reconcile · b accept"}`
|
||||
? `stale · ${n.pinned ? "b accept · p unlock" : "R reconcile · b accept"}`
|
||||
: "";
|
||||
return (
|
||||
<footer class="status">
|
||||
|
||||
+2
-2
@@ -168,7 +168,7 @@ export function NoteView({ v, inNote }: { v: VNote; inNote: boolean }) {
|
||||
const meta = (lens || stale || (v.id && snap.nodes[v.id].pinned)) && (
|
||||
<span class="meta">
|
||||
{lens}
|
||||
{v.id && snap.nodes[v.id].pinned ? " · pinned" : ""}
|
||||
{v.id && snap.nodes[v.id].pinned ? " · locked" : ""}
|
||||
{stale ? " · stale" : ""}
|
||||
</span>
|
||||
);
|
||||
@@ -354,7 +354,7 @@ export function Flags({ id }: { id: NodeId }) {
|
||||
conflict && "conflict",
|
||||
st.up && "sections changed",
|
||||
st.down && "parent changed",
|
||||
n.pinned && n.parent && "pinned",
|
||||
n.pinned && n.parent && "locked",
|
||||
].filter(Boolean) as string[];
|
||||
if (!flags.length) return null;
|
||||
return <span class={`flags${st.up || st.down || conflict ? " attn" : ""}`}>{flags.join(" · ")}</span>;
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ export const HELP: [string, [string, string][]][] = [
|
||||
["D", "delete (no confirmation; u undoes)"],
|
||||
["J K", "move down / up among siblings"],
|
||||
["> <", "indent / outdent (a document's sections can be moved into another this way, or over HTTP)"],
|
||||
["p", "pin or unpin: pinned nodes are never rewritten by the model"],
|
||||
["p", "lock or unlock: a locked node is never rewritten by the model (your own edits lock it). Not the same as P, which pins a pane"],
|
||||
["f", "on a note: cycle its form (inline · margin · inset)"],
|
||||
[":", "on a node: tell the editor agent what to change"],
|
||||
["u U", "undo / redo: the last edit made in this tab, in whichever document it was"],
|
||||
@@ -465,7 +465,7 @@ export function handleKey(e: KeyboardEvent, hooks: KeyHooks) {
|
||||
store.indent(-1);
|
||||
break;
|
||||
case "p":
|
||||
store.togglePin();
|
||||
store.toggleLock();
|
||||
break;
|
||||
case "f":
|
||||
store.cycleForm();
|
||||
|
||||
+6
-5
@@ -1925,11 +1925,12 @@ class Store {
|
||||
this.emit();
|
||||
}
|
||||
|
||||
togglePin() {
|
||||
/** p: lock or unlock a node. A locked node is never rewritten by a model (stored as `pinned`, its old name). */
|
||||
toggleLock() {
|
||||
if (!this.writable()) return;
|
||||
const n = this.snap.nodes[this.focus.node];
|
||||
this.apply([{ op: "update", id: n.id, pinned: !n.pinned }], `${n.pinned ? "Unpin" : "Pin"} “${clip(label(this.snap, n.id), 40)}”`);
|
||||
this.say(n.pinned ? "Unpinned: the model may rewrite this node." : "Pinned: the model will not rewrite this node.");
|
||||
this.apply([{ op: "update", id: n.id, pinned: !n.pinned }], `${n.pinned ? "Unlock" : "Lock"} “${clip(label(this.snap, n.id), 40)}”`);
|
||||
this.say(n.pinned ? "Unlocked: the model may rewrite this node." : "Locked: the model will not rewrite this node.");
|
||||
}
|
||||
|
||||
/** b: accept a stale node as it stands. */
|
||||
@@ -1948,7 +1949,7 @@ class Store {
|
||||
const id = this.focus.node;
|
||||
if (!this.generating) return this.say("No model configured.");
|
||||
if (!isStale(s, id)) return this.say("This node is not stale.");
|
||||
if (s.nodes[id].pinned) return this.say("Pinned nodes are not rewritten. p unpins; b accepts it as it stands.");
|
||||
if (s.nodes[id].pinned) return this.say("Locked nodes are not rewritten. p unlocks; b accepts it as it stands.");
|
||||
const doc = this.doc;
|
||||
void this.enqueue(`reconciling “${clip(label(s, id), 30)}”`, async () => {
|
||||
if (await reconcile(this.llm, doc, id, undefined, undefined, this.writeHooks())) this.status = "";
|
||||
@@ -2507,7 +2508,7 @@ class Store {
|
||||
|
||||
/** Why a key that works on a node does nothing on Wikipedia's text, for the status line; null for a key that does work there. */
|
||||
articleRefuses(k: string, selecting: boolean): string | null {
|
||||
const own = "Wikipedia's text is shown as it is: it cannot be edited, renamed, moved, pinned, reconciled or rewritten here. Annotations on it can: i selects words, e d y x c writes one.";
|
||||
const own = "Wikipedia's text is shown as it is: it cannot be edited, renamed, moved, locked, reconciled or rewritten here. Annotations on it can: i selects words, e d y x c writes one.";
|
||||
if (["r", "a", "A", "J", "K", ">", "<", "p", "R", "b", "o", "O", "z"].includes(k) && !(selecting && (k === "J" || k === "K"))) return own;
|
||||
if (k === "c" && !selecting) return "Wikipedia's text cannot be edited here. Select words (i) and press c to challenge them, or e d y x to annotate them.";
|
||||
if (["e", "d", "y", "x"].includes(k) && !selecting) return "Select words first: i, then e d y x c or :. An article itself is never deepened or rewritten.";
|
||||
|
||||
Reference in new issue
Block a user