Fix regression in `--no-color` / `NO_COLOR` theme
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Fix #4561
authored by Junegunn Choi · committed by Junegunn Choi · parent b852dc8 · Browse files · 3 files·+17 added−8 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+17 added−8 removed
- other:+17 added−8 removed
Provenance
- Commit
aa259fd- Tree
4ecd255- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
b852dc8
3 files changed+17 added−8 removed
modified:src/tui/tui.go+4 added-3 removed
293 unmodified lines294 return a.Color != colUndefined295 }296 297 func (a ColorAttr) IsAttrDefined() bool {298- return a.Attr != AttrUndefined298+ return a.Attr&^BoldForce != AttrUndefined299 }300+301 func (a ColorAttr) IsUndefined() bool {302 return !a.IsColorDefined() && !a.IsAttrDefined()303 }304 851 unmodified lines1156 // Inherit from 'fg', so that we don't have to write 'current-fg:dim'1157 // e.g. fzf --delimiter / --nth -1 --color fg:dim,nth:regular1158 current := theme.Current1159 if !baseTheme.Colored && current.IsUndefined() {1159- current.Attr = Reverse1160+ current.Attr |= Reverse1161 }1162 theme.Current = theme.Fg.Merge(o(baseTheme.Current, current))1163 currentMatch := theme.CurrentMatch1164 if !baseTheme.Colored && currentMatch.IsUndefined() {1164- currentMatch.Attr = Reverse | Underline1165+ currentMatch.Attr |= Reverse | Underline1166 }1167 theme.CurrentMatch = o(baseTheme.CurrentMatch, currentMatch)1168 theme.Spinner = o(baseTheme.Spinner, theme.Spinner)1169 theme.Info = o(baseTheme.Info, theme.Info)147 unmodified linesmodified:src/options.go+3 added-1 removed
671 unmodified lines672 return previewOpts{command, posRight, sizeSpec{50, true}, "", false, false, false, false, true, defaultBorderShape, 0, 0, nil}673 }674 675 func defaultOptions() *Options {676- var theme *tui.ColorTheme676+ var theme, baseTheme *tui.ColorTheme677 if os.Getenv("NO_COLOR") != "" {678 theme = tui.NoColorTheme679+ baseTheme = tui.NoColorTheme680 } else {681 theme = tui.EmptyTheme682 }683 19 unmodified lines703 Multi: 0,704 Ansi: false,705 Mouse: true,706 Theme: theme,707+ BaseTheme: baseTheme,708 Black: false,709 Bold: true,710 MinHeight: -10,711 Layout: layoutDefault,3073 unmodified linesmodified:CHANGELOG.md+10 added-4 removed
1 CHANGELOG2 =========3 4+0.66.15+------6+- Bug fixes7+ - Fixed a bug preventing 'ctrl-h' from being bound to an action (#4556)8+ - Fixed `--no-color` / `NO_COLOR` theme9+10 0.66.011 ------12 13 ### Quick summary26 unmodified lines40 41 42 This version introduces a new "raw" mode (named so because it shows the list43 "unfiltered"). In raw mode, non-matching items stay in their original positions,38-but appear dimmed. This allows you see surrounding items of a match and better39-understand the context of it. You can enable raw mode by default with `--raw`,40-but it's often more useful when toggled dynamically with the `toggle-raw`41-action.44+but appear dimmed. This allows you to see the surrounding items of a match and45+better understand the context of it. You can enable raw mode by default with46+`--raw`, but it's often more useful when toggled dynamically with the47+`toggle-raw` action.48 49 ```sh50 tree | fzf --reverse --bind alt-r:toggle-raw51 ```3042 unmodified lines