Fix inline header/footer border color when falling back to line

InitTheme was called before the runtime coerced BorderInline to
BorderLine, so HeaderBorder / FooterBorder inherited from ListBorder
even when the effective shape was 'line'. Mirror the coercion so
color inheritance matches the rendered shape.
This commit is contained in:
Junegunn Choi
2026-04-19 19:02:25 +09:00
parent d754cfab87
commit 01567b4f06
3 changed files with 37 additions and 3 deletions

View File

@@ -1167,10 +1167,14 @@ func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor
if baseTheme == nil {
baseTheme = renderer.DefaultTheme()
}
// This should be called before accessing tui.Color*
headerInline := opts.HeaderBorderShape == tui.BorderInline || opts.HeaderLinesShape == tui.BorderInline
footerInline := opts.FooterBorderShape == tui.BorderInline
// If the list border can't host an inline separator, the runtime later coerces
// BorderInline to BorderLine. Mirror that here so theme color inheritance matches
// the final rendering rather than the user's requested shape.
inlineListSupported := opts.ListBorderShape.HasTop() && opts.ListBorderShape.HasBottom()
headerInline := inlineListSupported && (opts.HeaderBorderShape == tui.BorderInline || opts.HeaderLinesShape == tui.BorderInline)
footerInline := inlineListSupported && opts.FooterBorderShape == tui.BorderInline
hasHeader := opts.HeaderBorderShape.Visible() || opts.HeaderLinesShape.Visible()
// This should be called before accessing tui.Color*
tui.InitTheme(opts.Theme, baseTheme, opts.Bold, opts.Black, opts.InputBorderShape.Visible(), hasHeader, headerInline, footerInline)
// Gutter character