Skip to content

Commit b491ebc

Browse files
authored
Merge pull request #761 from noborus/fix-760
fix: #760 Do not apply old style settings when Style is blank
2 parents 5c3ece8 + 6175947 commit b491ebc

File tree

1 file changed

+43
-14
lines changed

1 file changed

+43
-14
lines changed

oviewer/oviewer.go

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -909,20 +909,49 @@ func (root *Root) debugMessage(msg string) {
909909
// It reads and applies old style settings to maintain compatibility with older configurations.
910910
// Use the new style configuration methods instead.
911911
func setOldStyle(src RunTimeSettings, config Config) RunTimeSettings {
912-
src.Style.Body = config.StyleBody
913-
src.Style.Header = config.StyleHeader
914-
src.Style.LineNumber = config.StyleLineNumber
915-
src.Style.SearchHighlight = config.StyleSearchHighlight
916-
src.Style.ColumnHighlight = config.StyleColumnHighlight
917-
src.Style.MarkLine = config.StyleMarkLine
918-
src.Style.SectionLine = config.StyleSectionLine
919-
src.Style.VerticalHeader = config.StyleVerticalHeader
920-
src.Style.JumpTargetLine = config.StyleJumpTargetLine
921-
src.Style.Alternate = config.StyleAlternate
922-
src.Style.Ruler = config.StyleRuler
923-
src.Style.HeaderBorder = config.StyleHeaderBorder
924-
src.Style.SectionHeaderBorder = config.StyleSectionHeaderBorder
925-
src.Style.VerticalHeaderBorder = config.StyleVerticalHeaderBorder
912+
blank := OVStyle{}
913+
if config.StyleBody != blank {
914+
src.Style.Body = config.StyleBody
915+
}
916+
if config.StyleHeader != blank {
917+
src.Style.Header = config.StyleHeader
918+
}
919+
if config.StyleLineNumber != blank {
920+
src.Style.LineNumber = config.StyleLineNumber
921+
}
922+
if config.StyleSearchHighlight != blank {
923+
src.Style.SearchHighlight = config.StyleSearchHighlight
924+
}
925+
if config.StyleColumnHighlight != blank {
926+
src.Style.ColumnHighlight = config.StyleColumnHighlight
927+
}
928+
if config.StyleMarkLine != blank {
929+
src.Style.MarkLine = config.StyleMarkLine
930+
}
931+
if config.StyleSectionLine != blank {
932+
src.Style.SectionLine = config.StyleSectionLine
933+
}
934+
if config.StyleVerticalHeader != blank {
935+
src.Style.VerticalHeader = config.StyleVerticalHeader
936+
}
937+
if config.StyleJumpTargetLine != blank {
938+
src.Style.JumpTargetLine = config.StyleJumpTargetLine
939+
}
940+
if config.StyleAlternate != blank {
941+
src.Style.Alternate = config.StyleAlternate
942+
}
943+
if config.StyleRuler != blank {
944+
src.Style.Ruler = config.StyleRuler
945+
}
946+
if config.StyleHeaderBorder != blank {
947+
src.Style.HeaderBorder = config.StyleHeaderBorder
948+
}
949+
if config.StyleSectionHeaderBorder != blank {
950+
src.Style.SectionHeaderBorder = config.StyleSectionHeaderBorder
951+
}
952+
if config.StyleVerticalHeaderBorder != blank {
953+
src.Style.VerticalHeaderBorder = config.StyleVerticalHeaderBorder
954+
}
926955
return src
927956
}
928957

0 commit comments

Comments
 (0)