M1.15: one modal at a time, restore dialog follows outside restores
- Modal rule (ui/src/commands/modals.ts): palette, settings dialog and the
close question are exclusive; opening one closes the other. Running any
command but palette.open (keyboard, palette, uiCommand) closes the
palette. The restore dialog is queued: hidden while another modal is
open, back with its list intact afterwards.
- recovery.restore / recovery.discard emit recoveryResolved {paths}; the
restore dialog drops the settled paths and closes when none are left.
Rust was needed: discard gave the UI no signal, and a restored entry
stays in the journal as the buffer's own entry.
- Dimmed restored text (C2 screenshot 09) was the dialog overlay, not an
editor style; no editor change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d12a517009
commit
1a38e68480
13 changed files with 442 additions and 12 deletions
|
|
@ -14,12 +14,15 @@
|
|||
* buffer) with {@link useCommandsStore}'s `provide`. Other engine
|
||||
* commands run with empty params.
|
||||
* - **Errors:** a failed command raises an error toast (M1.12).
|
||||
* - **Palette:** running any command but `palette.open` closes the palette
|
||||
* first (the modal rule, `modals.ts`).
|
||||
*/
|
||||
import { defineStore } from "pinia";
|
||||
import { computed, ref, shallowReactive } from "vue";
|
||||
import { hasMessage, t } from "../i18n";
|
||||
import { listCommands, onEngineEvent, run, type CommandInfo, type EngineEventPayload, type JsonValue } from "../ipc";
|
||||
import { useNotificationsStore } from "../stores/notifications";
|
||||
import { useModalsStore } from "./modals";
|
||||
import { buildKeymap, commandFor, formatShortcut, isMac } from "./keymap";
|
||||
import { UI_COMMANDS } from "./uiCommands";
|
||||
|
||||
|
|
@ -84,6 +87,7 @@ function labelOf(info: CommandInfo): string {
|
|||
/** Store of the commands, the keymap and the recently run commands. */
|
||||
export const useCommandsStore = defineStore("commands", () => {
|
||||
const notifications = useNotificationsStore();
|
||||
const modals = useModalsStore();
|
||||
/** Commands as the engine lists them; empty until loaded. */
|
||||
const infos = ref<CommandInfo[]>([]);
|
||||
/** Handlers supplied by components, by command id. */
|
||||
|
|
@ -179,7 +183,8 @@ export const useCommandsStore = defineStore("commands", () => {
|
|||
/**
|
||||
* Runs a command the user chose (keyboard or palette): through its
|
||||
* handler if a component supplied one, else through the engine. A
|
||||
* disabled command does nothing. A failure raises an error toast.
|
||||
* disabled command does nothing. A failure raises an error toast. Any
|
||||
* command but `palette.open` closes the palette before it runs.
|
||||
*
|
||||
* @param id - the command id.
|
||||
* @param params - the params.
|
||||
|
|
@ -189,6 +194,9 @@ export const useCommandsStore = defineStore("commands", () => {
|
|||
return;
|
||||
}
|
||||
remember(id);
|
||||
if (id !== "palette.open") {
|
||||
modals.dismiss("palette");
|
||||
}
|
||||
const handler = handlers.get(id);
|
||||
if (handler) {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue