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:
parent
dfe2f19ca5
commit
d2344bf216
29 changed files with 1999 additions and 52 deletions
|
|
@ -11,15 +11,20 @@
|
|||
* (`assist/commands.ts`) and the tab management commands
|
||||
* (`tabs/commands.ts`). Diff tabs (M4.3, `vcs/diff/`) share the first
|
||||
* group's tab bar; while one is active the diff view replaces that group's
|
||||
* editor, and the area supplies the diff commands.
|
||||
* editor, and the area supplies the diff commands. Files changed on disk
|
||||
* (C10 A2): each pane shows its active tab's banner (`DiskBanner.vue`);
|
||||
* the area shows the overwrite question (`OverwritePrompt.vue`), both from
|
||||
* `stores/diskConflicts.ts`.
|
||||
*/
|
||||
import { onBeforeUnmount, onMounted } from "vue";
|
||||
import { useCommandsStore } from "../../commands/store";
|
||||
import { t } from "../../i18n";
|
||||
import { useEditorStore } from "../../stores/editor";
|
||||
import { useDiskConflictsStore } from "../../stores/diskConflicts";
|
||||
import ClosePrompt from "./ClosePrompt.vue";
|
||||
import EditorPane from "./EditorPane.vue";
|
||||
import { provideTabCommands } from "./tabs/commands";
|
||||
import OverwritePrompt from "./OverwritePrompt.vue";
|
||||
import { reveal, REVEAL_COMMAND } from "./reveal";
|
||||
import * as assist from "./assist/commands";
|
||||
import { provideDiffCommands } from "../vcs/diff/commands";
|
||||
|
|
@ -28,12 +33,14 @@ import { useDiffStore } from "../vcs/diff/diff";
|
|||
const editor = useEditorStore();
|
||||
const commands = useCommandsStore();
|
||||
const diff = useDiffStore();
|
||||
const disk = useDiskConflictsStore();
|
||||
|
||||
/** Withdraws the command handlers; filled while mounted. */
|
||||
let withdraw: (() => void)[] = [];
|
||||
|
||||
onMounted(() => {
|
||||
editor.start();
|
||||
disk.start();
|
||||
const hasActive = (): boolean => editor.activeTab !== null;
|
||||
withdraw = [
|
||||
commands.provide("file.save", { run: async () => { await editor.save(); }, enabled: hasActive }),
|
||||
|
|
@ -53,6 +60,7 @@ onBeforeUnmount(() => {
|
|||
fn();
|
||||
}
|
||||
withdraw = [];
|
||||
disk.stop();
|
||||
editor.stop();
|
||||
});
|
||||
</script>
|
||||
|
|
@ -96,6 +104,7 @@ onBeforeUnmount(() => {
|
|||
</button>
|
||||
</div>
|
||||
<ClosePrompt />
|
||||
<OverwritePrompt />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue