( cfg: ConfigFullResponse | null, setBell: (v: boolean) => void, setVoiceRecordKey?: (v: ParsedVoiceRecordKey) => void )
| 197 | } |
| 198 | |
| 199 | export const applyDisplay = ( |
| 200 | cfg: ConfigFullResponse | null, |
| 201 | setBell: (v: boolean) => void, |
| 202 | setVoiceRecordKey?: (v: ParsedVoiceRecordKey) => void |
| 203 | ) => { |
| 204 | const d = cfg?.config?.display ?? {} |
| 205 | |
| 206 | setBell(!!d.bell_on_complete) |
| 207 | |
| 208 | // Only push the voice record key when the RPC actually returned a |
| 209 | // config payload. ``quietRpc()`` collapses failures to ``null``; if we |
| 210 | // reset the cached shortcut on every null we would clobber a custom |
| 211 | // binding after one transient RPC error until the next config edit |
| 212 | // (Copilot round-8 review on #19835). The mtime-poll loop advances |
| 213 | // ``mtimeRef`` before this call, so staying silent on null preserves |
| 214 | // the last-good state and lets the next successful poll refresh it. |
| 215 | if (setVoiceRecordKey && cfg) { |
| 216 | setVoiceRecordKey(_voiceRecordKeyFromConfig(cfg)) |
| 217 | } |
| 218 | |
| 219 | patchUiState({ |
| 220 | busyInputMode: normalizeBusyInputMode(d.busy_input_mode), |
| 221 | compact: !!d.tui_compact, |
| 222 | detailsMode: resolveDetailsMode(d), |
| 223 | detailsModeCommandOverride: false, |
| 224 | indicatorStyle: normalizeIndicatorStyle(d.tui_status_indicator), |
| 225 | inlineDiffs: d.inline_diffs !== false, |
| 226 | mouseTracking: normalizeMouseTracking(d), |
| 227 | pasteCollapseLines: _pasteCollapseLinesFromConfig(cfg), |
| 228 | pasteCollapseChars: _pasteCollapseCharsFromConfig(cfg), |
| 229 | sections: resolveSections(d.sections), |
| 230 | showReasoning: !!d.show_reasoning, |
| 231 | statusBar: normalizeStatusBar(d.tui_statusbar), |
| 232 | streaming: d.streaming !== false |
| 233 | }) |
| 234 | } |
| 235 | |
| 236 | export function useConfigSync({ |
| 237 | gw, |
no test coverage detected