Terminal file viewer/editor + per-window app-command lockdown (#60)
Build App / compute-version (push) Successful in 7s
Secret Scan / scan (push) Successful in 8s
Build App / build-macos (push) Successful in 2m53s
Build App / build-linux (push) Successful in 5m12s
Build App / build-windows (push) Successful in 5m15s
Build App / create-tag (push) Successful in 3s
Build App / sync-to-github (push) Successful in 1m5s
Build App / compute-version (push) Successful in 7s
Secret Scan / scan (push) Successful in 8s
Build App / build-macos (push) Successful in 2m53s
Build App / build-linux (push) Successful in 5m12s
Build App / build-windows (push) Successful in 5m15s
Build App / create-tag (push) Successful in 3s
Build App / sync-to-github (push) Successful in 1m5s
Clicking a file path in Claude's terminal output now opens the file in its own window with a CodeMirror 6 editor. The editor highlights the target line, live-reloads while the file changes, and saves explicitly with hash-based conflict detection. The viewer commands are gated by window label. Every app command is now ACL-gated per window through a Tauri AppManifest. build.rs checks the handler list against the capability files and fails the build on any mismatch. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit was merged in pull request #60.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { EditorState, Text } from "@codemirror/state";
|
||||
import { highlightExtension, highlightLineField, lineRangeToPositions, setHighlight } from "./highlightLine";
|
||||
|
||||
describe("lineRangeToPositions", () => {
|
||||
const doc = Text.of(["one", "two", "three"]);
|
||||
it("maps 1-based inclusive lines to document offsets", () => {
|
||||
expect(lineRangeToPositions(doc, 2, 2)).toEqual({ from: 4, to: 4 });
|
||||
expect(lineRangeToPositions(doc, 1, 3)).toEqual({ from: 0, to: 8 });
|
||||
});
|
||||
it("clamps past the end and refuses nonsense", () => {
|
||||
expect(lineRangeToPositions(doc, 2, 99)).toEqual({ from: 4, to: 8 });
|
||||
expect(lineRangeToPositions(doc, 99, 100)).toEqual({ from: 8, to: 8 });
|
||||
expect(lineRangeToPositions(doc, 0, 1)).toEqual({ from: 0, to: 0 });
|
||||
expect(lineRangeToPositions(doc, 3, 1)).toEqual({ from: 8, to: 8 });
|
||||
});
|
||||
});
|
||||
|
||||
describe("highlightLineField", () => {
|
||||
it("decorates every line in the range and clears on null", () => {
|
||||
let state = EditorState.create({ doc: "a\nb\nc\nd", extensions: [highlightExtension()] });
|
||||
state = state.update({ effects: setHighlight.of({ from: 2, to: 3 }) }).state;
|
||||
let count = 0;
|
||||
state.field(highlightLineField).between(0, state.doc.length, () => { count++; });
|
||||
expect(count).toBe(2);
|
||||
state = state.update({ effects: setHighlight.of(null) }).state;
|
||||
count = 0;
|
||||
state.field(highlightLineField).between(0, state.doc.length, () => { count++; });
|
||||
expect(count).toBe(0);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user