diff --git a/components/SettingsPage.tsx b/components/SettingsPage.tsx index 170fc70d7..32694ce33 100644 --- a/components/SettingsPage.tsx +++ b/components/SettingsPage.tsx @@ -409,6 +409,7 @@ const SettingsPageContent: React.FC<{ settings: SettingsState; appLock?: AppLock const nestedDelayMs = (request.aiSubTab || request.syncSubTab) ? 80 : 40; const focusHandle = window.setTimeout(() => { void focusSettingsAnchor(request.anchorId, { + fallbackAnchorId: request.fallbackAnchorId, attempts: 48, delayMs: 50, }).finally(() => { diff --git a/components/settings/SettingsSearchControl.tsx b/components/settings/SettingsSearchControl.tsx index 9526b001a..efe54b1c4 100644 --- a/components/settings/SettingsSearchControl.tsx +++ b/components/settings/SettingsSearchControl.tsx @@ -93,6 +93,7 @@ export function SettingsSearchControl({ aiSubTab: hit.entry.aiSubTab, syncSubTab: hit.entry.syncSubTab, anchorId: hit.entry.id, + fallbackAnchorId: hit.entry.fallbackAnchorId, }); collapseSearch(false); }; diff --git a/components/settings/settingsFocus.test.ts b/components/settings/settingsFocus.test.ts index 038f1c81a..168ab31b3 100644 --- a/components/settings/settingsFocus.test.ts +++ b/components/settings/settingsFocus.test.ts @@ -1,6 +1,102 @@ import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; -import test from "node:test"; +import test, { type TestContext } from "node:test"; +import { settingsAnchorDomId } from "../../domain/settingsSearchCatalog.ts"; +import { focusSettingsAnchor } from "./settingsFocus.ts"; + +function setupFocusDom(t: TestContext) { + t.mock.timers.enable({ apis: ["setTimeout"] }); + const anchors = new Map(); + const focused: string[] = []; + const scrolled: string[] = []; + const globals = { + document: { + getElementById: (id: string) => anchors.get(id) ?? null, + querySelectorAll: () => [], + documentElement: {}, + body: {}, + }, + window: { setTimeout, clearTimeout }, + CSS: { escape: (value: string) => value }, + requestAnimationFrame: (callback: FrameRequestCallback) => { callback(0); return 0; }, + }; + for (const [key, value] of Object.entries(globals)) { + const previous = Object.getOwnPropertyDescriptor(globalThis, key); + Object.defineProperty(globalThis, key, { configurable: true, value }); + t.after(() => { + if (previous) Object.defineProperty(globalThis, key, previous); + else Reflect.deleteProperty(globalThis, key); + }); + } + const mount = (id: string, visible = true) => { + const classes = new Set(); + const el = { + closest: () => null, + checkVisibility: () => visible, + classList: { add: (name: string) => classes.add(name), remove: (name: string) => classes.delete(name) }, + matches: () => true, + hasAttribute: () => true, + focus: () => focused.push(id), + scrollIntoView: () => scrolled.push(id), + } as unknown as HTMLElement; + anchors.set(settingsAnchorDomId(id), el); + return classes; + }; + return { mount, focused, scrolled }; +} + +test("missing search target focuses and highlights its visible parent after a short mount window", async (t) => { + const { mount, focused, scrolled } = setupFocusDom(t); + const parentClasses = mount("parent"); + const result = focusSettingsAnchor("child", { fallbackAnchorId: "parent", attempts: 48, delayMs: 50 }); + + for (let retry = 0; retry < 3; retry += 1) t.mock.timers.tick(50); + t.mock.timers.tick(49); + assert.deepEqual(focused, []); + t.mock.timers.tick(1); + assert.equal(await result, true); + assert.deepEqual(focused, ["parent"]); + assert.deepEqual(scrolled, ["parent"]); + assert.ok(parentClasses.has("settings-search-highlight")); +}); + +test("search focus prefers a visible primary over its fallback", async (t) => { + const { mount, focused } = setupFocusDom(t); + const childClasses = mount("child"); + const parentClasses = mount("parent"); + + assert.equal(await focusSettingsAnchor("child", { fallbackAnchorId: "parent" }), true); + assert.deepEqual(focused, ["child"]); + assert.ok(childClasses.has("settings-search-highlight")); + assert.equal(parentClasses.has("settings-search-highlight"), false); +}); + +test("search focus waits for a lazy primary before using a visible fallback", async (t) => { + const { mount, focused } = setupFocusDom(t); + mount("parent"); + const result = focusSettingsAnchor("child", { fallbackAnchorId: "parent" }); + t.mock.timers.tick(50); + t.mock.timers.tick(50); + mount("child"); + t.mock.timers.tick(50); + + assert.equal(await result, true); + assert.deepEqual(focused, ["child"]); +}); + +test("search focus skips a hidden primary and waits for a visible fallback", async (t) => { + const { mount, focused } = setupFocusDom(t); + mount("child", false); + mount("parent", false); + const result = focusSettingsAnchor("child", { fallbackAnchorId: "parent" }); + for (let retry = 0; retry < 4; retry += 1) t.mock.timers.tick(50); + assert.deepEqual(focused, []); + mount("parent"); + t.mock.timers.tick(50); + + assert.equal(await result, true); + assert.deepEqual(focused, ["parent"]); +}); test("system setting hints sit below their cards with a shared top gap", () => { const uiSource = readFileSync(new URL("./settings-ui.tsx", import.meta.url), "utf8"); diff --git a/components/settings/settingsFocus.ts b/components/settings/settingsFocus.ts index cede7a491..8ea33938f 100644 --- a/components/settings/settingsFocus.ts +++ b/components/settings/settingsFocus.ts @@ -4,12 +4,15 @@ const HIGHLIGHT_CLASS = "settings-search-highlight"; const HIGHLIGHT_MS = 1600; /** Keep focused anchors slightly below the top of the settings content pane. */ const SCROLL_TOP_PADDING_PX = 24; +/** Allow 200ms at the default retry delay for lazy tab / sub-tab mounts. */ +const FALLBACK_AFTER_ATTEMPTS = 5; export type SettingsFocusTarget = { tab: string; aiSubTab?: string; syncSubTab?: string; anchorId: string; + fallbackAnchorId?: string; }; let focusGeneration = 0; @@ -30,6 +33,18 @@ function isAnchorVisible(el: HTMLElement): boolean { return el.getClientRects().length > 0; } +function findVisibleAnchor(anchorId: string): HTMLElement | undefined { + const candidates = [ + document.getElementById(settingsAnchorDomId(anchorId)), + ...Array.from( + document.querySelectorAll( + `[data-settings-anchor="${CSS.escape(anchorId)}"]`, + ), + ), + ].filter((node): node is HTMLElement => Boolean(node)); + return candidates.find((node) => isAnchorVisible(node)); +} + function focusAnchorElement(el: HTMLElement): void { const focusable = el.matches("button, a, input, select, textarea, [tabindex]") ? el @@ -103,15 +118,16 @@ export function scrollSettingsAnchorIntoView( /** * Scroll the settings content pane to a catalog anchor and briefly highlight it. * Retries to cover lazy tab mounts / nested sub-tab switches. + * After a short mount window, use a visible parent fallback for gated rows. */ export function focusSettingsAnchor( anchorId: string, - options?: { attempts?: number; delayMs?: number }, + options?: { attempts?: number; delayMs?: number; fallbackAnchorId?: string }, ): Promise { const attempts = options?.attempts ?? 40; const delayMs = options?.delayMs ?? 50; const generation = ++focusGeneration; - let remaining = attempts; + let attempt = 0; return new Promise((resolve) => { const finish = (ok: boolean) => { @@ -125,20 +141,13 @@ export function focusSettingsAnchor( return; } - const domId = settingsAnchorDomId(anchorId); - const candidates = [ - document.getElementById(domId), - ...Array.from( - document.querySelectorAll( - `[data-settings-anchor="${CSS.escape(anchorId)}"]`, - ), - ), - ].filter((node): node is HTMLElement => Boolean(node)); - - const el = candidates.find((node) => isAnchorVisible(node)); + attempt += 1; + let el = findVisibleAnchor(anchorId); + if (!el && options?.fallbackAnchorId && attempt >= Math.min(FALLBACK_AFTER_ATTEMPTS, attempts)) { + el = findVisibleAnchor(options.fallbackAnchorId); + } if (!el) { - remaining -= 1; - if (remaining > 0) { + if (attempt < attempts) { window.setTimeout(tryFocus, delayMs); return; } diff --git a/components/settings/tabs/AppLockSettingsSection.tsx b/components/settings/tabs/AppLockSettingsSection.tsx index 787b2092c..de9d72fdd 100644 --- a/components/settings/tabs/AppLockSettingsSection.tsx +++ b/components/settings/tabs/AppLockSettingsSection.tsx @@ -258,6 +258,7 @@ export const AppLockSettingsSection: React.FC = ({ diff --git a/components/settings/tabs/SettingsSystemTab.tsx b/components/settings/tabs/SettingsSystemTab.tsx index 2df4d8cb4..b44ab3727 100644 --- a/components/settings/tabs/SettingsSystemTab.tsx +++ b/components/settings/tabs/SettingsSystemTab.tsx @@ -693,6 +693,7 @@ const SettingsSystemTab: React.FC = ({ {httpNetworkProxy.mode === "custom" && ( <> @@ -710,6 +711,7 @@ const SettingsSystemTab: React.FC = ({ /> @@ -1088,7 +1090,7 @@ const SettingsSystemTab: React.FC = ({ {/* Directory Selection */} -
+
{t("settings.sessionLogs.directory")}
@@ -1125,10 +1127,11 @@ const SettingsSystemTab: React.FC = ({

{t("settings.sessionLogs.directoryHint")}

-
+ {/* Format Selection */} @@ -1141,6 +1144,7 @@ const SettingsSystemTab: React.FC = ({ diff --git a/components/settings/tabs/SettingsTerminalTab.tsx b/components/settings/tabs/SettingsTerminalTab.tsx index 57514c993..4e7df8da7 100644 --- a/components/settings/tabs/SettingsTerminalTab.tsx +++ b/components/settings/tabs/SettingsTerminalTab.tsx @@ -814,6 +814,7 @@ function SettingsTerminalTab(props: { @@ -841,6 +842,7 @@ function SettingsTerminalTab(props: { @@ -945,6 +947,7 @@ function SettingsTerminalTab(props: { @@ -1048,6 +1051,7 @@ function SettingsTerminalTab(props: { /> @@ -1082,6 +1086,7 @@ function SettingsTerminalTab(props: {
@@ -1092,6 +1097,7 @@ function SettingsTerminalTab(props: { {terminalSettings.showHostInfoBar && ( @@ -1119,6 +1125,7 @@ function SettingsTerminalTab(props: { {terminalSettings.showServerStats && ( @@ -1145,6 +1152,7 @@ function SettingsTerminalTab(props: {
@@ -1166,6 +1174,7 @@ function SettingsTerminalTab(props: {
@@ -1187,6 +1196,7 @@ function SettingsTerminalTab(props: {
@@ -1208,6 +1218,7 @@ function SettingsTerminalTab(props: { @@ -1249,6 +1260,7 @@ function SettingsTerminalTab(props: { /> @@ -1260,6 +1272,7 @@ function SettingsTerminalTab(props: { {terminalSettings.hibernateHiddenTabs && ( <> @@ -1281,6 +1294,7 @@ function SettingsTerminalTab(props: { @@ -1290,6 +1304,7 @@ function SettingsTerminalTab(props: { /> @@ -1308,6 +1323,7 @@ function SettingsTerminalTab(props: { /> @@ -1327,6 +1343,7 @@ function SettingsTerminalTab(props: { /> @@ -1354,6 +1371,7 @@ function SettingsTerminalTab(props: { {terminalSettings.inlineImagesEnabled && ( <> @@ -1363,6 +1381,7 @@ function SettingsTerminalTab(props: { /> @@ -1372,6 +1391,7 @@ function SettingsTerminalTab(props: { /> @@ -1381,6 +1401,7 @@ function SettingsTerminalTab(props: { /> @@ -1406,6 +1427,7 @@ function SettingsTerminalTab(props: { @@ -1431,6 +1453,7 @@ function SettingsTerminalTab(props: { @@ -1496,6 +1519,7 @@ function SettingsTerminalTab(props: { /> @@ -1506,6 +1530,7 @@ function SettingsTerminalTab(props: { /> @@ -1516,6 +1541,7 @@ function SettingsTerminalTab(props: { /> diff --git a/components/settings/tabs/TerminalBehaviorSettings.tsx b/components/settings/tabs/TerminalBehaviorSettings.tsx index ac17d4fb5..0557ea3b5 100644 --- a/components/settings/tabs/TerminalBehaviorSettings.tsx +++ b/components/settings/tabs/TerminalBehaviorSettings.tsx @@ -101,6 +101,7 @@ export const TerminalBehaviorSettings: React.FC = @@ -111,6 +112,7 @@ export const TerminalBehaviorSettings: React.FC = @@ -228,6 +230,7 @@ export const TerminalBehaviorSettings: React.FC = @@ -260,6 +263,7 @@ export const TerminalBehaviorSettings: React.FC = @@ -267,6 +271,7 @@ export const TerminalBehaviorSettings: React.FC = @@ -341,6 +346,7 @@ export const TerminalBehaviorSettings: React.FC = @@ -348,6 +354,7 @@ export const TerminalBehaviorSettings: React.FC = @@ -355,6 +362,7 @@ export const TerminalBehaviorSettings: React.FC = @@ -362,6 +370,7 @@ export const TerminalBehaviorSettings: React.FC = @@ -369,6 +378,7 @@ export const TerminalBehaviorSettings: React.FC = @@ -392,6 +402,7 @@ export const TerminalBehaviorSettings: React.FC = diff --git a/components/settings/tabs/ai/ExternalMcpCard.tsx b/components/settings/tabs/ai/ExternalMcpCard.tsx index 28f78107e..fb9761476 100644 --- a/components/settings/tabs/ai/ExternalMcpCard.tsx +++ b/components/settings/tabs/ai/ExternalMcpCard.tsx @@ -756,7 +756,7 @@ export const ExternalMcpCard: React.FC = () => { - + { /> - +
diff --git a/components/settings/tabs/ai/SafetySettings.tsx b/components/settings/tabs/ai/SafetySettings.tsx index 44ffc7d7b..96c4989a0 100644 --- a/components/settings/tabs/ai/SafetySettings.tsx +++ b/components/settings/tabs/ai/SafetySettings.tsx @@ -136,6 +136,7 @@ export const SafetySettings: React.FC<{ diff --git a/components/settings/tabs/ai/WebSearchSettings.tsx b/components/settings/tabs/ai/WebSearchSettings.tsx index c375a0e28..dc459b313 100644 --- a/components/settings/tabs/ai/WebSearchSettings.tsx +++ b/components/settings/tabs/ai/WebSearchSettings.tsx @@ -144,6 +144,7 @@ export const WebSearchSettings: React.FC<{ {/* API Key (hidden for SearXNG) */} {preset.requiresApiKey && ( @@ -170,6 +171,7 @@ export const WebSearchSettings: React.FC<{ {/* API Host */} diff --git a/domain/settingsSearch.test.ts b/domain/settingsSearch.test.ts index 3dd72b7da..a85930410 100644 --- a/domain/settingsSearch.test.ts +++ b/domain/settingsSearch.test.ts @@ -64,6 +64,41 @@ test("settings search catalog has unique ids", () => { assert.equal(new Set(ids).size, ids.length); }); +test("newly indexed gated settings retain visible parent destinations in search", () => { + const fallbacks = { + "terminal-hibernate-hidden-tabs-delay": "terminal-hibernate-hidden-tabs", + "terminal-hibernate-skip-alt-screen": "terminal-hibernate-hidden-tabs", + "terminal-hibernate-keep-renderer-count": "terminal-hibernate-hidden-tabs", + "terminal-hibernate-replay-chunk-bytes": "terminal-hibernate-hidden-tabs", + "terminal-hibernate-prefer-wasm-serialize": "terminal-hibernate-hidden-tabs", + "terminal-inline-images-kitty": "terminal-inline-images-enabled", + "terminal-inline-images-sixel": "terminal-inline-images-enabled", + "terminal-inline-images-iip": "terminal-inline-images-enabled", + "terminal-inline-images-storage-limit": "terminal-inline-images-enabled", + "terminal-inline-images-max-megapixels": "terminal-inline-images-enabled", + "terminal-inline-images-sequence-limit": "terminal-inline-images-enabled", + "terminal-host-info-bar-title-mode": "terminal-host-info-bar-show", + "terminal-server-stats-refresh-interval": "terminal-server-stats-show", + "ai-web-search-api-key": "ai-web-search-provider", + "system-network-proxy-url": "system-network-proxy-mode", + "system-network-proxy-bypass": "system-network-proxy-mode", + "system-app-lock-timeout": "system-app-lock", + }; + const hits = filterSettingsSearchCatalog("", (key) => en[key] ?? key, { limit: 500 }); + for (const [id, fallbackId] of Object.entries(fallbacks)) { + const entry = hits.find((hit) => hit.entry.id === id)?.entry; + assert.ok(entry, id); + assert.equal(entry.fallbackAnchorId, fallbackId, id); + const parent = SETTINGS_SEARCH_CATALOG.find((candidate) => candidate.id === fallbackId); + assert.ok(parent, fallbackId); + assert.equal(parent.tab, entry.tab, id); + assert.equal(parent.aiSubTab, entry.aiSubTab, id); + assert.equal(parent.fallbackAnchorId, undefined, fallbackId); + } + // The local start-directory row is always mounted in this UI. + assert.equal(hits.find((hit) => hit.entry.id === "terminal-local-shell-start-dir")?.entry.fallbackAnchorId, undefined); +}); + test("filterSettingsSearchCatalog matches English labels", () => { const hits = filterSettingsSearchCatalog("copy on select", tEn); assert.ok(hits.some((hit) => hit.entry.id === "terminal-copy-on-select")); @@ -167,6 +202,65 @@ test("settings search finds SSH connection keep-alive from the real locales", () } }); +test("settings search finds note typography from the real locales", () => { + const tZhReal = (key: string) => zhCN[key] ?? key; + const tEnReal = (key: string) => en[key] ?? key; + for (const [id, zhQuery, enQuery] of [ + ["appearance-vault-notes-font", "代码字体", "code font"], + ["appearance-vault-notes-font-size", "笔记字号", "note font size"], + ["appearance-vault-notes-code-font-size", "代码字号", "code font size"], + ] as const) { + for (const [t, query] of [[tZhReal, zhQuery], [tEnReal, enQuery]] as const) { + const hit = filterSettingsSearchCatalog(query, t).find((hit) => hit.entry.id === id); + assert.ok(hit, `${query} should find ${id}`); + assert.equal(hit.entry.tab, "appearance"); + } + } +}); + +test("settings search finds session log options from the real locales", () => { + const tZhReal = (key: string) => zhCN[key] ?? key; + const tEnReal = (key: string) => en[key] ?? key; + for (const [id, t, queries] of [ + ["system-session-logs-directory", tZhReal, ["保存目录"]], + ["system-session-logs-directory", tEnReal, ["save directory"]], + ["system-session-logs-format", tZhReal, ["日志格式"]], + ["system-session-logs-format", tEnReal, ["log format"]], + ["system-session-logs-timestamps", tZhReal, ["时间戳"]], + ["system-session-logs-timestamps", tEnReal, ["timestamp", "Add timestamps"]], + ] as const) { + for (const query of queries) { + const hit = filterSettingsSearchCatalog(query, t).find((hit) => hit.entry.id === id); + assert.ok(hit, `${query} should find ${id}`); + assert.equal(hit.entry.tab, "system"); + assert.equal(hit.entry.sectionKey, "settings.sessionLogs.title"); + } + } +}); + +test("later-added settings retain their tab and sub-tab destinations", () => { + const tZhReal = (key: string) => zhCN[key] ?? key; + const tEnReal = (key: string) => en[key] ?? key; + for (const [id, tab, subTab, labelKey] of [ + ["terminal-font-ligatures", "terminal", undefined, "settings.terminal.font.ligatures"], + ["terminal-local-shell-side-panel-auto-open", "terminal", undefined, "settings.terminal.localShellSidePanel.autoOpen"], + ["terminal-system-manager-process-refresh-interval", "terminal", undefined, "settings.terminal.systemManager.processRefreshInterval"], + ["ai-chat-history-message-cap", "ai", "tools", "ai.chatHistory.messageCap"], + ["ai-web-search-max-results", "ai", "search", "ai.webSearch.maxResults"], + ["ai-safety-max-iterations", "ai", "safety", "ai.safety.maxIterations"], + ["sync-ai-sessions", "sync", "status", "cloudSync.aiSessions.title"], + ["system-network-proxy-url", "system", undefined, "settings.system.networkProxy.url"], + ] as const) { + for (const t of [tZhReal, tEnReal]) { + assert.notEqual(t(labelKey), labelKey); + const hit = filterSettingsSearchCatalog(t(labelKey), t).find((hit) => hit.entry.id === id); + assert.ok(hit, `${t(labelKey)} should find ${id}`); + assert.equal(hit.entry.tab, tab); + assert.equal(hit.entry.aiSubTab ?? hit.entry.syncSubTab, subTab); + } + } +}); + test("settings search finds temporary network device mode", () => { const tEnReal = (key: string) => en[key] ?? key; const tZhTW = (key: string) => zhTW[key] ?? key; diff --git a/domain/settingsSearchCatalog.anchors.test.ts b/domain/settingsSearchCatalog.anchors.test.ts index 84e985cdf..028e403b4 100644 --- a/domain/settingsSearchCatalog.anchors.test.ts +++ b/domain/settingsSearchCatalog.anchors.test.ts @@ -24,7 +24,7 @@ function collectSourceFiles(root: string): string[] { return out; } -test("every settings search catalog id is wired as an anchor in components", () => { +test("every settings search catalog id and fallback is wired as an anchor in components", () => { const roots = [ join(process.cwd(), "components"), ]; @@ -32,7 +32,7 @@ test("every settings search catalog id is wired as an anchor in components", () const haystack = sources.map((file) => readFileSync(file, "utf8")).join("\n"); const missing = SETTINGS_SEARCH_CATALOG - .map((entry) => entry.id) + .flatMap((entry) => [entry.id, ...(entry.fallbackAnchorId ? [entry.fallbackAnchorId] : [])]) .filter((id) => { const asProp = `anchorId="${id}"`; const asPropSingle = `anchorId='${id}'`; diff --git a/domain/settingsSearchCatalog.ts b/domain/settingsSearchCatalog.ts index 167019933..4f2a7c093 100644 --- a/domain/settingsSearchCatalog.ts +++ b/domain/settingsSearchCatalog.ts @@ -36,6 +36,11 @@ export type SettingsPlatform = "mac" | "win" | "linux"; export type SettingsSearchEntry = { /** Stable id; also used as `data-settings-anchor` on the target element. */ id: string; + /** + * Already-mounted parent to highlight when a prerequisite setting is off and + * this entry's own anchor is not in the DOM. + */ + fallbackAnchorId?: string; tab: SettingsTabId; /** Nested AI settings tab when `tab === "ai"`. */ aiSubTab?: AISettingsSubTabId; @@ -214,6 +219,27 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "settings.vault.autoImportSystemKnownHostsDesc", sectionKey: "settings.vault.title", }, + { + id: "appearance-vault-notes-font", + tab: "appearance", + labelKey: "settings.vault.notesFont", + descriptionKey: "settings.vault.notesFontDesc", + sectionKey: "settings.vault.title", + }, + { + id: "appearance-vault-notes-font-size", + tab: "appearance", + labelKey: "settings.vault.notesFontSize", + descriptionKey: "settings.vault.notesFontSizeDesc", + sectionKey: "settings.vault.title", + }, + { + id: "appearance-vault-notes-code-font-size", + tab: "appearance", + labelKey: "settings.vault.notesCodeFontSize", + descriptionKey: "settings.vault.notesCodeFontSizeDesc", + sectionKey: "settings.vault.title", + }, { id: "appearance-custom-css", tab: "appearance", @@ -273,6 +299,13 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "settings.terminal.font.smoothing.desc", sectionKey: "settings.terminal.section.font", }, + { + id: "terminal-font-ligatures", + tab: "terminal", + labelKey: "settings.terminal.font.ligatures", + descriptionKey: "settings.terminal.font.ligatures.desc", + sectionKey: "settings.terminal.section.font", + }, { id: "terminal-font-line-padding", tab: "terminal", @@ -366,6 +399,20 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "settings.terminal.behavior.rightClick.desc", sectionKey: "settings.terminal.section.behavior", }, + { + id: "terminal-right-click-long-press-menu", + tab: "terminal", + labelKey: "settings.terminal.behavior.rightClick.longPressMenu", + descriptionKey: "settings.terminal.behavior.rightClick.longPressMenu.desc", + sectionKey: "settings.terminal.section.behavior", + }, + { + id: "terminal-right-click-fullscreen-menu", + tab: "terminal", + labelKey: "settings.terminal.behavior.rightClick.fullscreenMenu", + descriptionKey: "settings.terminal.behavior.rightClick.fullscreenMenu.desc", + sectionKey: "settings.terminal.section.behavior", + }, { id: "terminal-copy-on-select", tab: "terminal", @@ -415,6 +462,13 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "settings.terminal.behavior.confirmMultilinePaste.desc", sectionKey: "settings.terminal.section.behavior", }, + { + id: "terminal-confirm-multiline-paste-min-lines", + tab: "terminal", + labelKey: "settings.terminal.behavior.confirmMultilinePasteMinLines", + descriptionKey: "settings.terminal.behavior.confirmMultilinePasteMinLines.desc", + sectionKey: "settings.terminal.section.behavior", + }, { id: "terminal-shift-enter-newline", tab: "terminal", @@ -422,6 +476,13 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "settings.terminal.behavior.shiftEnterNewline.desc", sectionKey: "settings.terminal.section.behavior", }, + { + id: "terminal-shift-enter-newline-text", + tab: "terminal", + labelKey: "settings.terminal.behavior.shiftEnterNewlineText", + descriptionKey: "settings.terminal.behavior.shiftEnterNewlineText.desc", + sectionKey: "settings.terminal.section.behavior", + }, { id: "terminal-shift-enter-force-text", tab: "terminal", @@ -443,6 +504,20 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "settings.terminal.behavior.clearWipesScrollback.desc", sectionKey: "settings.terminal.section.behavior", }, + { + id: "terminal-preserve-selection-on-input", + tab: "terminal", + labelKey: "settings.terminal.behavior.preserveSelectionOnInput", + descriptionKey: "settings.terminal.behavior.preserveSelectionOnInput.desc", + sectionKey: "settings.terminal.section.behavior", + }, + { + id: "terminal-force-prompt-new-line", + tab: "terminal", + labelKey: "settings.terminal.behavior.forcePromptNewLine", + descriptionKey: "settings.terminal.behavior.forcePromptNewLine.desc", + sectionKey: "settings.terminal.section.behavior", + }, { id: "terminal-tab-double-click", tab: "terminal", @@ -472,6 +547,55 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "settings.terminal.behavior.osc52Clipboard.desc", sectionKey: "settings.terminal.section.behavior", }, + { + id: "terminal-scroll-on-input", + tab: "terminal", + labelKey: "settings.terminal.behavior.scrollOnInput", + descriptionKey: "settings.terminal.behavior.scrollOnInput.desc", + sectionKey: "settings.terminal.section.behavior", + }, + { + id: "terminal-scroll-on-output", + tab: "terminal", + labelKey: "settings.terminal.behavior.scrollOnOutput", + descriptionKey: "settings.terminal.behavior.scrollOnOutput.desc", + sectionKey: "settings.terminal.section.behavior", + }, + { + id: "terminal-scroll-on-key-press", + tab: "terminal", + labelKey: "settings.terminal.behavior.scrollOnKeyPress", + descriptionKey: "settings.terminal.behavior.scrollOnKeyPress.desc", + sectionKey: "settings.terminal.section.behavior", + }, + { + id: "terminal-scroll-on-paste", + tab: "terminal", + labelKey: "settings.terminal.behavior.scrollOnPaste", + descriptionKey: "settings.terminal.behavior.scrollOnPaste.desc", + sectionKey: "settings.terminal.section.behavior", + }, + { + id: "terminal-smooth-scrolling", + tab: "terminal", + labelKey: "settings.terminal.behavior.smoothScrolling", + descriptionKey: "settings.terminal.behavior.smoothScrolling.desc", + sectionKey: "settings.terminal.section.behavior", + }, + { + id: "terminal-link-browser", + tab: "terminal", + labelKey: "settings.terminal.behavior.linkBrowser", + descriptionKey: "settings.terminal.behavior.linkBrowser.desc", + sectionKey: "settings.terminal.section.behavior", + }, + { + id: "terminal-link-modifier", + tab: "terminal", + labelKey: "settings.terminal.behavior.linkModifier", + descriptionKey: "settings.terminal.behavior.linkModifier.desc", + sectionKey: "settings.terminal.section.behavior", + }, { id: "terminal-scrollback-rows", tab: "terminal", @@ -493,6 +617,27 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "settings.terminal.sidePanel.autoOpen.desc", sectionKey: "settings.terminal.section.sidePanel", }, + { + id: "terminal-side-panel-auto-open-pane", + tab: "terminal", + labelKey: "settings.terminal.sidePanel.autoOpenPane", + descriptionKey: "settings.terminal.sidePanel.autoOpenPane.desc", + sectionKey: "settings.terminal.section.sidePanel", + }, + { + id: "terminal-local-shell-side-panel-auto-open", + tab: "terminal", + labelKey: "settings.terminal.localShellSidePanel.autoOpen", + descriptionKey: "settings.terminal.localShellSidePanel.autoOpen.desc", + sectionKey: "settings.terminal.section.localShellSidePanel", + }, + { + id: "terminal-local-shell-side-panel-auto-open-pane", + tab: "terminal", + labelKey: "settings.terminal.localShellSidePanel.autoOpenPane", + descriptionKey: "settings.terminal.localShellSidePanel.autoOpenPane.desc", + sectionKey: "settings.terminal.section.localShellSidePanel", + }, { id: "terminal-keyword-highlight", tab: "terminal", @@ -507,6 +652,13 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "settings.terminal.localShell.shell.desc", sectionKey: "settings.terminal.section.localShell", }, + { + id: "terminal-local-shell-start-dir", + tab: "terminal", + labelKey: "settings.terminal.localShell.startDir", + descriptionKey: "settings.terminal.localShell.startDir.desc", + sectionKey: "settings.terminal.section.localShell", + }, { id: "terminal-default-proxy", tab: "terminal", @@ -552,6 +704,13 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "settings.terminal.connection.keepaliveInterval.desc", sectionKey: "settings.terminal.section.connection", }, + { + id: "terminal-keepalive-count-max", + tab: "terminal", + labelKey: "settings.terminal.connection.keepaliveCountMax", + descriptionKey: "settings.terminal.connection.keepaliveCountMax.desc", + sectionKey: "settings.terminal.section.connection", + }, { id: "terminal-x11-display", tab: "terminal", @@ -560,6 +719,21 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ sectionKey: "settings.terminal.section.connection", keywords: ["x11", "display"], }, + { + id: "terminal-host-info-bar-show", + tab: "terminal", + labelKey: "settings.terminal.hostInfoBar.show", + descriptionKey: "settings.terminal.hostInfoBar.show.desc", + sectionKey: "settings.terminal.section.serverStats", + }, + { + id: "terminal-host-info-bar-title-mode", + fallbackAnchorId: "terminal-host-info-bar-show", + tab: "terminal", + labelKey: "settings.terminal.hostInfoBar.titleMode", + descriptionKey: "settings.terminal.hostInfoBar.titleMode.desc", + sectionKey: "settings.terminal.section.serverStats", + }, { id: "terminal-server-stats-show", tab: "terminal", @@ -567,6 +741,42 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "settings.terminal.serverStats.show.desc", sectionKey: "settings.terminal.section.serverStats", }, + { + id: "terminal-server-stats-refresh-interval", + fallbackAnchorId: "terminal-server-stats-show", + tab: "terminal", + labelKey: "settings.terminal.serverStats.refreshInterval", + descriptionKey: "settings.terminal.serverStats.refreshInterval.desc", + sectionKey: "settings.terminal.section.serverStats", + }, + { + id: "terminal-system-manager-process-refresh-interval", + tab: "terminal", + labelKey: "settings.terminal.systemManager.processRefreshInterval", + descriptionKey: "settings.terminal.systemManager.processRefreshInterval.desc", + sectionKey: "settings.terminal.section.systemManager", + }, + { + id: "terminal-system-manager-tmux-refresh-interval", + tab: "terminal", + labelKey: "settings.terminal.systemManager.tmuxRefreshInterval", + descriptionKey: "settings.terminal.systemManager.tmuxRefreshInterval.desc", + sectionKey: "settings.terminal.section.systemManager", + }, + { + id: "terminal-system-manager-docker-list-refresh-interval", + tab: "terminal", + labelKey: "settings.terminal.systemManager.dockerListRefreshInterval", + descriptionKey: "settings.terminal.systemManager.dockerListRefreshInterval.desc", + sectionKey: "settings.terminal.section.systemManager", + }, + { + id: "terminal-system-manager-docker-stats-refresh-interval", + tab: "terminal", + labelKey: "settings.terminal.systemManager.dockerStatsRefreshInterval", + descriptionKey: "settings.terminal.systemManager.dockerStatsRefreshInterval.desc", + sectionKey: "settings.terminal.section.systemManager", + }, { id: "terminal-renderer", tab: "terminal", @@ -575,6 +785,53 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ sectionKey: "settings.terminal.section.rendering", keywords: ["webgl", "canvas"], }, + { + id: "terminal-hibernate-hidden-tabs", + tab: "terminal", + labelKey: "settings.terminal.rendering.hibernateHiddenTabs", + descriptionKey: "settings.terminal.rendering.hibernateHiddenTabs.desc", + sectionKey: "settings.terminal.section.rendering", + }, + { + id: "terminal-hibernate-hidden-tabs-delay", + fallbackAnchorId: "terminal-hibernate-hidden-tabs", + tab: "terminal", + labelKey: "settings.terminal.rendering.hibernateHiddenTabsDelay", + descriptionKey: "settings.terminal.rendering.hibernateHiddenTabsDelay.desc", + sectionKey: "settings.terminal.section.rendering", + }, + { + id: "terminal-hibernate-skip-alt-screen", + fallbackAnchorId: "terminal-hibernate-hidden-tabs", + tab: "terminal", + labelKey: "settings.terminal.rendering.hibernateSkipAltScreen", + descriptionKey: "settings.terminal.rendering.hibernateSkipAltScreen.desc", + sectionKey: "settings.terminal.section.rendering", + }, + { + id: "terminal-hibernate-keep-renderer-count", + fallbackAnchorId: "terminal-hibernate-hidden-tabs", + tab: "terminal", + labelKey: "settings.terminal.rendering.hibernateKeepRendererCount", + descriptionKey: "settings.terminal.rendering.hibernateKeepRendererCount.desc", + sectionKey: "settings.terminal.section.rendering", + }, + { + id: "terminal-hibernate-replay-chunk-bytes", + fallbackAnchorId: "terminal-hibernate-hidden-tabs", + tab: "terminal", + labelKey: "settings.terminal.rendering.hibernateReplayChunkBytes", + descriptionKey: "settings.terminal.rendering.hibernateReplayChunkBytes.desc", + sectionKey: "settings.terminal.section.rendering", + }, + { + id: "terminal-hibernate-prefer-wasm-serialize", + fallbackAnchorId: "terminal-hibernate-hidden-tabs", + tab: "terminal", + labelKey: "settings.terminal.rendering.hibernatePreferWasmSerialize", + descriptionKey: "settings.terminal.rendering.hibernatePreferWasmSerialize.desc", + sectionKey: "settings.terminal.section.rendering", + }, { id: "terminal-inline-images-enabled", tab: "terminal", @@ -583,6 +840,54 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ sectionKey: "settings.terminal.section.inlineImages", keywords: ["sixel", "kitty", "iip"], }, + { + id: "terminal-inline-images-kitty", + fallbackAnchorId: "terminal-inline-images-enabled", + tab: "terminal", + labelKey: "settings.terminal.inlineImages.kitty", + descriptionKey: "settings.terminal.inlineImages.kitty.desc", + sectionKey: "settings.terminal.section.inlineImages", + }, + { + id: "terminal-inline-images-sixel", + fallbackAnchorId: "terminal-inline-images-enabled", + tab: "terminal", + labelKey: "settings.terminal.inlineImages.sixel", + descriptionKey: "settings.terminal.inlineImages.sixel.desc", + sectionKey: "settings.terminal.section.inlineImages", + }, + { + id: "terminal-inline-images-iip", + fallbackAnchorId: "terminal-inline-images-enabled", + tab: "terminal", + labelKey: "settings.terminal.inlineImages.iip", + descriptionKey: "settings.terminal.inlineImages.iip.desc", + sectionKey: "settings.terminal.section.inlineImages", + }, + { + id: "terminal-inline-images-storage-limit", + fallbackAnchorId: "terminal-inline-images-enabled", + tab: "terminal", + labelKey: "settings.terminal.inlineImages.storageLimit", + descriptionKey: "settings.terminal.inlineImages.storageLimit.desc", + sectionKey: "settings.terminal.section.inlineImages", + }, + { + id: "terminal-inline-images-max-megapixels", + fallbackAnchorId: "terminal-inline-images-enabled", + tab: "terminal", + labelKey: "settings.terminal.inlineImages.maxMegapixels", + descriptionKey: "settings.terminal.inlineImages.maxMegapixels.desc", + sectionKey: "settings.terminal.section.inlineImages", + }, + { + id: "terminal-inline-images-sequence-limit", + fallbackAnchorId: "terminal-inline-images-enabled", + tab: "terminal", + labelKey: "settings.terminal.inlineImages.sequenceLimit", + descriptionKey: "settings.terminal.inlineImages.sequenceLimit.desc", + sectionKey: "settings.terminal.section.inlineImages", + }, { id: "terminal-workspace-focus-style", tab: "terminal", @@ -598,6 +903,27 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ sectionKey: "settings.terminal.section.autocomplete", keywords: ["completion", "补全"], }, + { + id: "terminal-autocomplete-ghost-text", + tab: "terminal", + labelKey: "settings.terminal.autocomplete.ghostText", + descriptionKey: "settings.terminal.autocomplete.ghostText.desc", + sectionKey: "settings.terminal.section.autocomplete", + }, + { + id: "terminal-autocomplete-popup-menu", + tab: "terminal", + labelKey: "settings.terminal.autocomplete.popupMenu", + descriptionKey: "settings.terminal.autocomplete.popupMenu.desc", + sectionKey: "settings.terminal.section.autocomplete", + }, + { + id: "terminal-autocomplete-history-scope", + tab: "terminal", + labelKey: "settings.terminal.autocomplete.historyScope", + descriptionKey: "settings.terminal.autocomplete.historyScope.desc", + sectionKey: "settings.terminal.section.autocomplete", + }, { id: "terminal-password-prompt-assist", tab: "terminal", @@ -779,6 +1105,13 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ labelKey: "ai.defaultAgent", descriptionKey: "ai.defaultAgent.description", }, + { + id: "ai-privacy", + tab: "ai", + aiSubTab: "tools", + labelKey: "ai.privacy.title", + descriptionKey: "ai.privacy.description", + }, { id: "ai-chat-shortcuts-selection", tab: "ai", @@ -819,6 +1152,29 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ sectionKey: "ai.externalMcp.title", keywords: ["notification", "approval", "dock"], }, + { + id: "ai-chat-history-message-cap", + tab: "ai", + aiSubTab: "tools", + labelKey: "ai.chatHistory.messageCap", + descriptionKey: "ai.chatHistory.messageCap.description", + sectionKey: "ai.chatHistory.title", + }, + { + id: "ai-external-mcp-behavior", + tab: "ai", + aiSubTab: "tools", + labelKey: "ai.toolSettings.behavior", + sectionKey: "ai.externalMcp.title", + }, + { + id: "ai-external-mcp-client-configuration", + tab: "ai", + aiSubTab: "tools", + labelKey: "ai.externalMcp.clientConfiguration", + descriptionKey: "ai.externalMcp.clientConfiguration.description", + sectionKey: "ai.externalMcp.title", + }, { id: "ai-user-skills", tab: "ai", @@ -850,6 +1206,31 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "ai.webSearch.provider.description", sectionKey: "ai.webSearch.title", }, + { + id: "ai-web-search-api-key", + fallbackAnchorId: "ai-web-search-provider", + tab: "ai", + aiSubTab: "search", + labelKey: "ai.webSearch.apiKey", + descriptionKey: "ai.webSearch.apiKey.description", + sectionKey: "ai.webSearch.title", + }, + { + id: "ai-web-search-api-host", + tab: "ai", + aiSubTab: "search", + labelKey: "ai.webSearch.apiHost", + descriptionKey: "ai.webSearch.apiHost.description", + sectionKey: "ai.webSearch.title", + }, + { + id: "ai-web-search-max-results", + tab: "ai", + aiSubTab: "search", + labelKey: "ai.webSearch.maxResults", + descriptionKey: "ai.webSearch.maxResults.description", + sectionKey: "ai.webSearch.title", + }, { id: "ai-safety-permission-mode", tab: "ai", @@ -876,6 +1257,14 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ sectionKey: "ai.safety.title", keywords: ["response", "request", "idle", "timeout", "响应", "请求", "超时"], }, + { + id: "ai-safety-max-iterations", + tab: "ai", + aiSubTab: "safety", + labelKey: "ai.safety.maxIterations", + descriptionKey: "ai.safety.maxIterations.description", + sectionKey: "ai.safety.title", + }, { id: "ai-safety-blocklist", tab: "ai", @@ -915,6 +1304,13 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ labelKey: "cloudSync.strategy.title", descriptionKey: "cloudSync.strategy.desc", }, + { + id: "sync-ai-sessions", + tab: "sync", + syncSubTab: "status", + labelKey: "cloudSync.aiSessions.title", + descriptionKey: "cloudSync.aiSessions.desc", + }, { id: "sync-local-backups", tab: "sync", @@ -962,6 +1358,22 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ sectionKey: "settings.system.networkProxy.title", keywords: ["proxy", "http", "代理"], }, + { + id: "system-network-proxy-url", + fallbackAnchorId: "system-network-proxy-mode", + tab: "system", + labelKey: "settings.system.networkProxy.url", + descriptionKey: "settings.system.networkProxy.url.desc", + sectionKey: "settings.system.networkProxy.title", + }, + { + id: "system-network-proxy-bypass", + fallbackAnchorId: "system-network-proxy-mode", + tab: "system", + labelKey: "settings.system.networkProxy.bypass", + descriptionKey: "settings.system.networkProxy.bypass.desc", + sectionKey: "settings.system.networkProxy.title", + }, { id: "system-app-lock", tab: "system", @@ -969,6 +1381,14 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "settings.appLock.description", keywords: ["app lock", "applock", "lock", "应用锁", "锁屏", "idle", "timeout", "无操作"], }, + { + id: "system-app-lock-timeout", + fallbackAnchorId: "system-app-lock", + tab: "system", + labelKey: "settings.appLock.timeout", + descriptionKey: "settings.appLock.timeoutDesc", + sectionKey: "settings.appLock.title", + }, { id: "system-credentials", tab: "system", @@ -1017,6 +1437,27 @@ export const SETTINGS_SEARCH_CATALOG: readonly SettingsSearchEntry[] = [ descriptionKey: "settings.sessionLogs.enableAutoSaveDesc", sectionKey: "settings.sessionLogs.title", }, + { + id: "system-session-logs-directory", + tab: "system", + labelKey: "settings.sessionLogs.directory", + descriptionKey: "settings.sessionLogs.directoryHint", + sectionKey: "settings.sessionLogs.title", + }, + { + id: "system-session-logs-format", + tab: "system", + labelKey: "settings.sessionLogs.format", + descriptionKey: "settings.sessionLogs.formatDesc", + sectionKey: "settings.sessionLogs.title", + }, + { + id: "system-session-logs-timestamps", + tab: "system", + labelKey: "settings.sessionLogs.timestamps", + descriptionKey: "settings.sessionLogs.timestampsDesc", + sectionKey: "settings.sessionLogs.title", + }, { id: "system-ssh-deep-link", tab: "system",