@@ -10,6 +10,7 @@ import gitdiff
1010
1111struct CustomizationPlayground : View {
1212 @State private var showLineNumbers = true
13+ @State private var showFileHeaders = true
1314 @State private var fontSize : CGFloat = 13
1415 @State private var lineSpacing : DiffConfiguration . LineSpacing = . compact
1516 @State private var wordWrap = true
@@ -29,6 +30,7 @@ struct CustomizationPlayground: View {
2930 DiffRenderer ( diffText: SampleDiffs . configPlaygroundDiff)
3031 . diffTheme ( selectedTheme)
3132 . diffLineNumbers ( showLineNumbers)
33+ . diffFileHeaders ( showFileHeaders)
3234 . diffFont ( size: fontSize, weight: fontWeight)
3335 . diffLineSpacing ( lineSpacing)
3436 . diffWordWrap ( wordWrap)
@@ -43,6 +45,7 @@ struct CustomizationPlayground: View {
4345 fontSize: fontSize,
4446 fontWeight: fontWeight,
4547 lineNumbers: showLineNumbers,
48+ fileHeaders: showFileHeaders,
4649 wordWrap: wordWrap,
4750 lineSpacing: lineSpacing
4851 )
@@ -61,6 +64,7 @@ struct CustomizationPlayground: View {
6164 . sheet ( isPresented: $showCustomizationSheet) {
6265 CustomizationSheet (
6366 showLineNumbers: $showLineNumbers,
67+ showFileHeaders: $showFileHeaders,
6468 fontSize: $fontSize,
6569 lineSpacing: $lineSpacing,
6670 wordWrap: $wordWrap,
@@ -83,6 +87,7 @@ struct CustomizationPlayground: View {
8387
8488struct CustomizationSheet : View {
8589 @Binding var showLineNumbers : Bool
90+ @Binding var showFileHeaders : Bool
8691 @Binding var fontSize : CGFloat
8792 @Binding var lineSpacing : DiffConfiguration . LineSpacing
8893 @Binding var wordWrap : Bool
@@ -147,7 +152,9 @@ struct CustomizationSheet: View {
147152 . font ( . headline)
148153
149154 Toggle ( " Show Line Numbers " , isOn: $showLineNumbers)
150-
155+
156+ Toggle ( " Show File Headers " , isOn: $showFileHeaders)
157+
151158 Toggle ( " Word Wrap " , isOn: $wordWrap)
152159
153160 VStack ( alignment: . leading, spacing: 8 ) {
@@ -224,6 +231,7 @@ struct CustomizationSheet: View {
224231 withAnimation {
225232 selectedTheme = config. theme
226233 showLineNumbers = config. showLineNumbers
234+ showFileHeaders = config. showFileHeaders
227235 fontSize = config. fontSize
228236 fontWeight = config. fontWeight
229237 lineSpacing = config. lineSpacing
@@ -234,6 +242,7 @@ struct CustomizationSheet: View {
234242 private func resetToDefaults( ) {
235243 withAnimation {
236244 showLineNumbers = true
245+ showFileHeaders = true
237246 fontSize = 13
238247 lineSpacing = . compact
239248 wordWrap = true
@@ -271,6 +280,7 @@ struct ConfigurationSummary: View {
271280 let fontSize : CGFloat
272281 let fontWeight : Font . Weight
273282 let lineNumbers : Bool
283+ let fileHeaders : Bool
274284 let wordWrap : Bool
275285 let lineSpacing : DiffConfiguration . LineSpacing
276286
@@ -284,6 +294,7 @@ struct ConfigurationSummary: View {
284294 ConfigItem ( label: " Font Size " , value: " \( Int ( fontSize) ) pt " )
285295 ConfigItem ( label: " Font Weight " , value: fontWeightName)
286296 ConfigItem ( label: " Line Numbers " , value: lineNumbers ? " On " : " Off " )
297+ ConfigItem ( label: " File Headers " , value: fileHeaders ? " On " : " Off " )
287298 ConfigItem ( label: " Word Wrap " , value: wordWrap ? " On " : " Off " )
288299 ConfigItem ( label: " Line Spacing " , value: lineSpacingName)
289300 }
0 commit comments