1
1
mirror of https://github.com/walles/moar.git synced 2024-11-22 03:14:56 +03:00

Fix unknown-terminal-bg color handling

Before this change, we just didn't highlight in this case.

With this change in place, we now fall back on the default dark theme
when background color detection fails.

Fixes <https://github.com/walles/moar/issues/202>.
This commit is contained in:
Johan Walles 2024-04-29 20:35:06 +02:00
parent 4db604533d
commit 52cf51f35e

View File

@ -710,7 +710,7 @@ func pagerFromArgs(
return nil, nil, chroma.Style{}, nil, nil
}
var style chroma.Style
var style chroma.Style = *styles.Get(defaultDarkTheme)
if *styleOption == nil {
t0 := time.Now()
screen.RequestTerminalBackgroundColor()
@ -744,6 +744,7 @@ func pagerFromArgs(
} else {
style = **styleOption
}
log.Debug("Using style <", style.Name, ">")
reader.SetStyleForHighlighting(style)
pager := m.NewPager(reader)