M3.10: autosave and flushDirty
Autosave saves dirty buffers when the window loses focus (DOM blur and
visibilitychange), when the active tab changes and after
editor.autosave.idleSeconds (default 15) without an edit; three settings,
all on by default. flushDirty() in ui/src/stores/autosave.ts is the one
save-all-dirty-and-wait entry point for later deployment, run and
terminal features: it waits for pending buffer sync, then runs
file.saveAll {skipConflicts: true}; one toast per failed file.
Engine: file.saveAll takes skipConflicts and returns skipped; Buffers
tracks buffers in conflict with their file and the hash of the last
read/written content, so our own save reported late is not a conflict.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
228669036c
commit
e1dc24dc25
18 changed files with 996 additions and 37 deletions
|
|
@ -8,6 +8,7 @@
|
|||
* `theme.ts`; a failed theme report raises an error toast) and the global
|
||||
* keymap with the UI commands (see `commands/store.ts`), and loads the settings so the
|
||||
* editor font size applies from the start (see `stores/settings.ts`).
|
||||
* Starts autosave (see `stores/autosave.ts`).
|
||||
*/
|
||||
import { onMounted, onUnmounted } from "vue";
|
||||
import { useCommandsStore } from "./commands/store";
|
||||
|
|
@ -19,6 +20,7 @@ import NotificationStack from "./components/notifications/NotificationStack.vue"
|
|||
import RecoveryDialog from "./components/recovery/RecoveryDialog.vue";
|
||||
import SettingsDialog from "./components/settings/SettingsDialog.vue";
|
||||
import { useAppStore } from "./stores/app";
|
||||
import { useAutosaveStore } from "./stores/autosave";
|
||||
import { useNotificationsStore } from "./stores/notifications";
|
||||
import { useSettingsStore } from "./stores/settings";
|
||||
import { startTheme } from "./theme";
|
||||
|
|
@ -27,6 +29,7 @@ const app = useAppStore();
|
|||
const notifications = useNotificationsStore();
|
||||
const commands = useCommandsStore();
|
||||
const settings = useSettingsStore();
|
||||
const autosave = useAutosaveStore();
|
||||
|
||||
/** Stops following the theme; set while mounted. */
|
||||
let stopTheme: (() => void) | null = null;
|
||||
|
|
@ -36,6 +39,7 @@ onMounted(() => {
|
|||
stopTheme = startTheme((error) => notifications.notifyError("theme.systemPreference", error));
|
||||
void commands.start();
|
||||
void settings.start();
|
||||
autosave.start();
|
||||
void app.loadAbout();
|
||||
});
|
||||
|
||||
|
|
@ -43,6 +47,7 @@ onUnmounted(() => {
|
|||
stopTheme?.();
|
||||
stopTheme = null;
|
||||
commands.stop();
|
||||
autosave.stop();
|
||||
settings.stop();
|
||||
notifications.stop();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue