Save interface-scale changes from every window
Ctrl/Cmd +/-/0 in editor and connection-manager windows called SettingsService.persist() -> saveSettings, but only the main window's RPC served that request: it went unanswered, the new scale applied locally, and the next broadcast from main snapped it back. All three window RPCs now serve saveSettings through one shared saveSettingsHandler (persist, then hand off). index.ts's settingsSaved() is the single place settings side effects run — transfer concurrency, locale + app menu, the preload snapshot — whichever window saved, and it rebroadcasts to every window EXCEPT the sender: an echo arriving behind a newer local change (a held Cmd+) would drag it backwards. Editors are skipped by their registry key, main and the manager by name. Known ceiling, noted at the handler: whole-object writes, so two windows saving in the same instant means the later one wins. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,8 @@ export interface EditorWindowsDeps {
|
||||
mainFrame: () => { x: number; y: number };
|
||||
/** Late-bound senders targeting the MAIN window's webview. */
|
||||
notifyMain: { pathRefresh: (info: { sessionId: string; dir: string }) => void };
|
||||
/** An editor saved settings; `key` identifies it so the rebroadcast skips it. */
|
||||
onSettingsSaved: (settings: AppSettings, key: string) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,6 +79,7 @@ export class EditorWindows {
|
||||
record.suppressPrompt = true;
|
||||
record.win?.close();
|
||||
},
|
||||
onSettingsSaved: (next) => this.deps.onSettingsSaved(next, key),
|
||||
},
|
||||
);
|
||||
|
||||
@@ -165,8 +168,11 @@ export class EditorWindows {
|
||||
});
|
||||
}
|
||||
|
||||
broadcastSettings(settings: AppSettings): void {
|
||||
this.windows.forEach((rec) => rec.rpc.send.settingsChanged({ settings }));
|
||||
/** `exceptKey`: the editor that saved — it already shows the new values. */
|
||||
broadcastSettings(settings: AppSettings, exceptKey?: string): void {
|
||||
this.windows.forEach((rec, key) => {
|
||||
if (key !== exceptKey) rec.rpc.send.settingsChanged({ settings });
|
||||
});
|
||||
}
|
||||
|
||||
private baseTitle(ctx: EditorOpenContext): string {
|
||||
|
||||
Reference in New Issue
Block a user