A2: disk-conflict banner, overwrite question and Local History dialog

- Banner inside the editor pane for a dirty tab whose file changed
  (Reload (discard mine) / Keep mine / Compare) or was deleted (Keep as
  unsaved / Close); state in stores/diskConflicts.ts, the old notice is gone.
- Save and save all ask Overwrite / Cancel when the engine refuses with
  disk_changed.
- Diff tabs against the disk text (file.readDisk) and a Local History
  entry (history.read); "Revert to This" in the caption.
- Show Local History dialog (history.show: tree context menu, palette,
  File menu) with Show Diff and an undoable Revert to This.
- History failures warn once until a snapshot works again.
- Docs: docs/local-history.md, G2 in gaps.md, ui-parity, architecture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-08 12:23:14 +01:00
parent dfe2f19ca5
commit d2344bf216
29 changed files with 1999 additions and 52 deletions

View file

@ -4,7 +4,7 @@
* `buffer.edit`, the dirty marker, closing (middle click, shortcut, the
* Save / Don't Save / Cancel question), saving through the global keymap
* (`commands/store.ts`) with shortcuts loaded from the engine's command
* list, the notice for files changed on disk, and the UI command
* list, the banner for files changed on disk, and the UI command
* `editor.reveal` (open and closed files, CRLF text, bad params).
* The engine is a fake behind the mocked Tauri `invoke`.
*/
@ -482,16 +482,16 @@ describe("EditorArea", () => {
expect(editor.activeId).toBe(1);
});
it("shows a notice when a dirty file changes on disk, and an open error", async () => {
it("shows the disk banner when a dirty file changes on disk, and an open error", async () => {
const area = await mountArea();
const editor = useEditorStore(pinia);
await editor.openFile("a.php");
await flushPromises();
emitEditorEvent({ kind: "fileChangedOnDisk", id: 1, path: "a.php", removed: false });
await flushPromises();
expect(area.find("[data-test=editor-notice]").text()).toContain("changed on disk");
await area.find("[data-test=notice-dismiss]").trigger("click");
expect(area.find("[data-test=editor-notice]").exists()).toBe(false);
expect(area.find("[data-test=disk-banner]").text()).toContain("changed by another program");
await area.find("[data-test=disk-keep]").trigger("click");
expect(area.find("[data-test=disk-banner]").exists()).toBe(false);
await editor.openFile("missing.php");
await flushPromises();