Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/ipc/configValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ function validateDisplaySection(data: unknown): ValidationSuccess<'display'> | V
'showTimestamps',
'compactMode',
'syntaxHighlighting',
'keepContextNavExpanded',
];

const result: Partial<DisplayConfig> = {};
Expand Down
2 changes: 2 additions & 0 deletions src/main/services/infrastructure/ConfigManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export interface DisplayConfig {
showTimestamps: boolean;
compactMode: boolean;
syntaxHighlighting: boolean;
keepContextNavExpanded: boolean;
}

export interface SessionsConfig {
Expand Down Expand Up @@ -257,6 +258,7 @@ const DEFAULT_CONFIG: AppConfig = {
showTimestamps: true,
compactMode: false,
syntaxHighlighting: true,
keepContextNavExpanded: false,
},
sessions: {
pinnedSessions: {},
Expand Down
10 changes: 8 additions & 2 deletions src/renderer/components/chat/ChatHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ export const ChatHistory = ({ tabId }: ChatHistoryProps): JSX.Element => {
if (!element) return;

element.scrollIntoView({ behavior: 'smooth', block: 'center' });
if (useStore.getState().appConfig?.display?.keepContextNavExpanded) {
expandAIGroup(groupId);
}
setHighlightedGroupId(groupId);
setIsNavigationHighlight(true);
if (navigationHighlightTimerRef.current) {
Expand All @@ -428,7 +431,7 @@ export const ChatHistory = ({ tabId }: ChatHistoryProps): JSX.Element => {
};
void run();
},
[conversation, ensureGroupVisible, setHighlightedGroupId]
[conversation, ensureGroupVisible, setHighlightedGroupId, expandAIGroup]
);

// Handler to navigate to a user message group (preceding the AI group at turnIndex)
Expand Down Expand Up @@ -481,6 +484,9 @@ export const ChatHistory = ({ tabId }: ChatHistoryProps): JSX.Element => {
await ensureGroupVisible(groupId);

// Set group + tool highlight immediately
if (useStore.getState().appConfig?.display?.keepContextNavExpanded) {
expandAIGroup(groupId);
}
setHighlightedGroupId(groupId);
setIsNavigationHighlight(true);
setContextNavToolUseId(toolUseId);
Expand Down Expand Up @@ -513,7 +519,7 @@ export const ChatHistory = ({ tabId }: ChatHistoryProps): JSX.Element => {
};
void run();
},
[conversation, ensureGroupVisible, setHighlightedGroupId]
[conversation, ensureGroupVisible, setHighlightedGroupId, expandAIGroup]
);

// Scroll to current search result when it changes
Expand Down
1 change: 1 addition & 0 deletions src/renderer/components/settings/SettingsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export const SettingsView = (): React.JSX.Element | null => {
safeConfig={safeConfig}
saving={saving}
onGeneralToggle={handlers.handleGeneralToggle}
onDisplayToggle={handlers.handleDisplayToggle}
onThemeChange={handlers.handleThemeChange}
/>
)}
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/settings/hooks/useSettingsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface SafeConfig {
showTimestamps: boolean;
compactMode: boolean;
syntaxHighlighting: boolean;
keepContextNavExpanded: boolean;
};
}

Expand Down Expand Up @@ -173,6 +174,7 @@ export function useSettingsConfig(): UseSettingsConfigReturn {
showTimestamps: displayConfig?.display?.showTimestamps ?? true,
compactMode: displayConfig?.display?.compactMode ?? false,
syntaxHighlighting: displayConfig?.display?.syntaxHighlighting ?? true,
keepContextNavExpanded: displayConfig?.display?.keepContextNavExpanded ?? false,
},
}),
[displayConfig]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ export function useSettingsHandlers({
showTimestamps: true,
compactMode: false,
syntaxHighlighting: true,
keepContextNavExpanded: false,
},
sessions: {
pinnedSessions: {},
Expand Down
12 changes: 12 additions & 0 deletions src/renderer/components/settings/sections/GeneralSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ interface GeneralSectionProps {
readonly safeConfig: SafeConfig;
readonly saving: boolean;
readonly onGeneralToggle: (key: keyof AppConfig['general'], value: boolean) => void;
readonly onDisplayToggle: (key: keyof AppConfig['display'], value: boolean) => void;
readonly onThemeChange: (value: 'dark' | 'light' | 'system') => void;
}

export const GeneralSection = ({
safeConfig,
saving,
onGeneralToggle,
onDisplayToggle,
onThemeChange,
}: GeneralSectionProps): React.JSX.Element => {
const [serverStatus, setServerStatus] = useState<HttpServerStatus>({
Expand Down Expand Up @@ -297,6 +299,16 @@ export const GeneralSection = ({
disabled={saving}
/>
</SettingRow>
<SettingRow
label="Keep expanded after context navigation"
description="Keep AI response groups expanded after navigating to them from the Visible Context panel"
>
<SettingsToggle
enabled={safeConfig.display.keepContextNavExpanded}
onChange={(v) => onDisplayToggle('keepContextNavExpanded', v)}
disabled={saving}
/>
</SettingRow>
{isElectron && !window.navigator.userAgent.includes('Macintosh') && (
<SettingRow
label="Use native title bar"
Expand Down
2 changes: 2 additions & 0 deletions src/shared/types/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ export interface AppConfig {
compactMode: boolean;
/** Whether to enable syntax highlighting in code blocks */
syntaxHighlighting: boolean;
/** Whether to keep AI groups expanded after navigating from the Visible Context panel */
keepContextNavExpanded: boolean;
};
/** Session-related settings */
sessions: {
Expand Down
1 change: 1 addition & 0 deletions test/mocks/electronAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export function createMockElectronAPI(): MockElectronAPI {
showTimestamps: true,
compactMode: false,
syntaxHighlighting: true,
keepContextNavExpanded: false,
},
sessions: {
pinnedSessions: {},
Expand Down
Loading