Skip to content

Commit 6b91b25

Browse files
committed
feat: persist terminal copy-on-select setting
1 parent 5b26588 commit 6b91b25

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

packages/server/src/commands/settings.test.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,31 @@ describe("settings commands", () => {
6767
).toEqual({ value: "600" });
6868
});
6969

70+
it("settings.update persists appearance.terminalCopyOnSelect into user_settings", async () => {
71+
const result = await dispatch(
72+
{
73+
kind: "command",
74+
id: "settings-update-terminal-copy-on-select",
75+
op: "settings.update",
76+
args: {
77+
settings: {
78+
appearance: {
79+
terminalCopyOnSelect: true,
80+
},
81+
},
82+
},
83+
},
84+
ctx
85+
);
86+
87+
expect(result.ok).toBe(true);
88+
expect(
89+
db
90+
.prepare("SELECT value FROM user_settings WHERE key = ?")
91+
.get("appearance.terminalCopyOnSelect")
92+
).toEqual({ value: "true" });
93+
});
94+
7095
it("settings.update rejects fractional supervisor timeout values", async () => {
7196
const result = await dispatch(
7297
{
@@ -270,6 +295,26 @@ describe("settings commands", () => {
270295
});
271296
});
272297

298+
it("settings.get reads appearance.terminalCopyOnSelect from user_settings", async () => {
299+
db.prepare("INSERT INTO user_settings (key, value) VALUES (?, ?)").run(
300+
"appearance.terminalCopyOnSelect",
301+
"true"
302+
);
303+
304+
const result = await dispatch(
305+
{
306+
kind: "command",
307+
id: "settings-get-terminal-copy-on-select",
308+
op: "settings.get",
309+
args: {},
310+
},
311+
ctx
312+
);
313+
314+
expect(result.ok).toBe(true);
315+
expect(result.data?.["appearance.terminalCopyOnSelect"]).toBe(true);
316+
});
317+
273318
it("settings.get normalizes invalid persisted supervisor timeout values", async () => {
274319
db.prepare("INSERT INTO user_settings (key, value) VALUES (?, ?)").run(
275320
"supervisor.evaluationTimeoutSec",

packages/server/src/commands/settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const SettingsSchema = z.object({
4848
.object({
4949
theme: z.enum(["dark"]).optional(),
5050
terminalRenderer: z.enum(["standard", "compatibility"]).optional(),
51+
terminalCopyOnSelect: z.boolean().optional(),
5152
locale: z.enum(["zh", "en"]).optional(),
5253
})
5354
.optional(),

0 commit comments

Comments
 (0)