@@ -19,6 +19,7 @@ import {
1919import {
2020 DEFAULT_ENVIRONMENT_IDENTIFICATION_MODE ,
2121 DEFAULT_UNIFIED_SETTINGS ,
22+ type DiffLayout ,
2223 type EnvironmentIdentificationMode ,
2324 MAX_APPEARANCE_CONTRAST ,
2425 MAX_CODE_FONT_SIZE ,
@@ -169,6 +170,11 @@ const TIMESTAMP_FORMAT_LABELS = {
169170 "24-hour" : "24-hour" ,
170171} as const ;
171172
173+ const DIFF_LAYOUT_LABELS : Record < DiffLayout , string > = {
174+ stacked : "Stacked" ,
175+ split : "Split" ,
176+ } ;
177+
172178const QUIT_CONFIRMATION_MODE_LABELS : Record < QuitConfirmationMode , string > = {
173179 direct : "Direct" ,
174180 hold : "Hold" ,
@@ -527,6 +533,7 @@ export function useSettingsRestore(onRestored?: () => void) {
527533 ...( settings . diffIgnoreWhitespace !== DEFAULT_UNIFIED_SETTINGS . diffIgnoreWhitespace
528534 ? [ "Diff whitespace changes" ]
529535 : [ ] ) ,
536+ ...( settings . diffLayout !== DEFAULT_UNIFIED_SETTINGS . diffLayout ? [ "Diff layout" ] : [ ] ) ,
530537 ...( settings . proactivePanelsEnabled !== DEFAULT_UNIFIED_SETTINGS . proactivePanelsEnabled
531538 ? [ "Proactive panels" ]
532539 : [ ] ) ,
@@ -593,6 +600,7 @@ export function useSettingsRestore(onRestored?: () => void) {
593600 settings . defaultThreadEnvMode ,
594601 settings . newWorktreesStartFromOrigin ,
595602 settings . diffIgnoreWhitespace ,
603+ settings . diffLayout ,
596604 settings . proactivePanelsEnabled ,
597605 settings . environmentIdentificationMode ,
598606 settings . contextWindowMeterEnabled ,
@@ -689,6 +697,7 @@ export function useSettingsRestore(onRestored?: () => void) {
689697 timestampFormat : DEFAULT_UNIFIED_SETTINGS . timestampFormat ,
690698 wordWrap : DEFAULT_UNIFIED_SETTINGS . wordWrap ,
691699 diffIgnoreWhitespace : DEFAULT_UNIFIED_SETTINGS . diffIgnoreWhitespace ,
700+ diffLayout : DEFAULT_UNIFIED_SETTINGS . diffLayout ,
692701 proactivePanelsEnabled : DEFAULT_UNIFIED_SETTINGS . proactivePanelsEnabled ,
693702 showSkillsInSlashMenu : DEFAULT_UNIFIED_SETTINGS . showSkillsInSlashMenu ,
694703 contextWindowMeterEnabled : DEFAULT_UNIFIED_SETTINGS . contextWindowMeterEnabled ,
@@ -2223,6 +2232,41 @@ export function GeneralSettingsPanel() {
22232232 }
22242233 />
22252234
2235+ < SettingsRow
2236+ { ...searchableSetting ( "diff-layout" ) }
2237+ description = "Show diffs stacked or side by side. The toggle in the diff toolbar changes this too."
2238+ resetAction = {
2239+ settings . diffLayout !== DEFAULT_UNIFIED_SETTINGS . diffLayout ? (
2240+ < SettingResetButton
2241+ label = "diff layout"
2242+ onClick = { ( ) => updateSettings ( { diffLayout : DEFAULT_UNIFIED_SETTINGS . diffLayout } ) }
2243+ />
2244+ ) : null
2245+ }
2246+ control = {
2247+ < Select
2248+ value = { settings . diffLayout }
2249+ onValueChange = { ( value ) => {
2250+ if ( value === "stacked" || value === "split" ) {
2251+ updateSettings ( { diffLayout : value } ) ;
2252+ }
2253+ } }
2254+ >
2255+ < SelectTrigger size = "sm" className = "w-full sm:w-40" aria-label = "Diff layout" >
2256+ < SelectValue > { DIFF_LAYOUT_LABELS [ settings . diffLayout ] } </ SelectValue >
2257+ </ SelectTrigger >
2258+ < SelectPopup align = "end" alignItemWithTrigger = { false } >
2259+ < SelectItem hideIndicator value = "stacked" >
2260+ { DIFF_LAYOUT_LABELS . stacked }
2261+ </ SelectItem >
2262+ < SelectItem hideIndicator value = "split" >
2263+ { DIFF_LAYOUT_LABELS . split }
2264+ </ SelectItem >
2265+ </ SelectPopup >
2266+ </ Select >
2267+ }
2268+ />
2269+
22262270 < SettingsRow
22272271 { ...searchableSetting ( "proactive-panels" ) }
22282272 description = "Automatically open the linked pull request when it appears and the turn diff when agent work finishes."
0 commit comments