From 60f37aae2f2f5d087b95eb29fca64d86417e7734 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 26 Mar 2023 23:39:05 +0900 Subject: [PATCH] Respect 'regular' attribute in 'bw' base theme Don't make the text bold if an element is explicitly specified as 'regular'. Fix #3222 --- src/options.go | 4 +--- src/terminal.go | 6 ------ src/tui/tui.go | 38 +++++++++++++++++++------------------- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/options.go b/src/options.go index f2de1d7..9f953bd 100644 --- a/src/options.go +++ b/src/options.go @@ -2003,9 +2003,7 @@ func postProcessOptions(opts *Options) { theme := opts.Theme boldify := func(c tui.ColorAttr) tui.ColorAttr { dup := c - if !theme.Colored { - dup.Attr |= tui.Bold - } else if (c.Attr & tui.AttrRegular) == 0 { + if (c.Attr & tui.AttrRegular) == 0 { dup.Attr |= tui.Bold } return dup diff --git a/src/terminal.go b/src/terminal.go index 5196d5c..468b90f 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -201,7 +201,6 @@ type Terminal struct { tabstop int margin [4]sizeSpec padding [4]sizeSpec - strong tui.Attr unicode bool listenPort *int borderShape tui.BorderShape @@ -541,10 +540,6 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal { if len(opts.Preview.command) > 0 || hasPreviewAction(opts) || opts.ListenPort != nil { previewBox = util.NewEventBox() } - strongAttr := tui.Bold - if !opts.Bold { - strongAttr = tui.AttrRegular - } var renderer tui.Renderer fullscreen := !opts.Height.auto && (opts.Height.size == 0 || opts.Height.percent && opts.Height.size == 100) if fullscreen { @@ -623,7 +618,6 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal { previewLabelOpts: opts.PreviewLabel, cleanExit: opts.ClearOnExit, paused: opts.Phony, - strong: strongAttr, cycle: opts.Cycle, headerFirst: opts.HeaderFirst, headerLines: opts.HeaderLines, diff --git a/src/tui/tui.go b/src/tui/tui.go index a51627f..3d67c48 100644 --- a/src/tui/tui.go +++ b/src/tui/tui.go @@ -525,28 +525,28 @@ func EmptyTheme() *ColorTheme { func NoColorTheme() *ColorTheme { return &ColorTheme{ Colored: false, - Input: ColorAttr{colDefault, AttrRegular}, - Fg: ColorAttr{colDefault, AttrRegular}, - Bg: ColorAttr{colDefault, AttrRegular}, - DarkBg: ColorAttr{colDefault, AttrRegular}, - Prompt: ColorAttr{colDefault, AttrRegular}, + Input: ColorAttr{colDefault, AttrUndefined}, + Fg: ColorAttr{colDefault, AttrUndefined}, + Bg: ColorAttr{colDefault, AttrUndefined}, + DarkBg: ColorAttr{colDefault, AttrUndefined}, + Prompt: ColorAttr{colDefault, AttrUndefined}, Match: ColorAttr{colDefault, Underline}, Current: ColorAttr{colDefault, Reverse}, CurrentMatch: ColorAttr{colDefault, Reverse | Underline}, - Spinner: ColorAttr{colDefault, AttrRegular}, - Info: ColorAttr{colDefault, AttrRegular}, - Cursor: ColorAttr{colDefault, AttrRegular}, - Selected: ColorAttr{colDefault, AttrRegular}, - Header: ColorAttr{colDefault, AttrRegular}, - Border: ColorAttr{colDefault, AttrRegular}, - BorderLabel: ColorAttr{colDefault, AttrRegular}, - Disabled: ColorAttr{colDefault, AttrRegular}, - PreviewFg: ColorAttr{colDefault, AttrRegular}, - PreviewBg: ColorAttr{colDefault, AttrRegular}, - Gutter: ColorAttr{colDefault, AttrRegular}, - PreviewLabel: ColorAttr{colDefault, AttrRegular}, - Separator: ColorAttr{colDefault, AttrRegular}, - Scrollbar: ColorAttr{colDefault, AttrRegular}, + Spinner: ColorAttr{colDefault, AttrUndefined}, + Info: ColorAttr{colDefault, AttrUndefined}, + Cursor: ColorAttr{colDefault, AttrUndefined}, + Selected: ColorAttr{colDefault, AttrUndefined}, + Header: ColorAttr{colDefault, AttrUndefined}, + Border: ColorAttr{colDefault, AttrUndefined}, + BorderLabel: ColorAttr{colDefault, AttrUndefined}, + Disabled: ColorAttr{colDefault, AttrUndefined}, + PreviewFg: ColorAttr{colDefault, AttrUndefined}, + PreviewBg: ColorAttr{colDefault, AttrUndefined}, + Gutter: ColorAttr{colDefault, AttrUndefined}, + PreviewLabel: ColorAttr{colDefault, AttrUndefined}, + Separator: ColorAttr{colDefault, AttrUndefined}, + Scrollbar: ColorAttr{colDefault, AttrUndefined}, } }