Skip to content
Myr

Fix --color=bw on tcell build

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 3dfc020 · Browse files · 1 file+27 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

1 file+27 added−8 removed

  • other:+27 added−8 removed

1 file+27 added−8 removed

modified:src/tui/tcell.go+27 added-8 removed
138 unmodified lines
139140 _color = theme != nil141 if _color {142 InitTheme(theme, black)143 } else {144 theme = DefaultTheme()145 }146 ColNormal = ColorPair{theme.Fg, theme.Bg}147 ColPrompt = ColorPair{theme.Prompt, theme.Bg}148 ColMatch = ColorPair{theme.Match, theme.Bg}
291 unmodified lines
440func (w *Window) PrintString(text string, pair ColorPair, a Attr) {441 t := text442 lx := 0443442 // TODO respect attr443 style := pair.style().444 var style tcell.Style445 if _color {446 style = pair.style().447 Reverse(a&Attr(tcell.AttrReverse) != 0).448 Underline(a&Attr(tcell.AttrUnderline) != 0)449 } else {450 style = ColDefault.style().451 Reverse(a&Attr(tcell.AttrReverse) != 0 || pair == ColCurrent || pair == ColCurrentMatch).452 Underline(a&Attr(tcell.AttrUnderline) != 0 || pair == ColMatch || pair == ColCurrentMatch)453 }454 style = style.455 Blink(a&Attr(tcell.AttrBlink) != 0).456 Bold(a&Attr(tcell.AttrBold) != 0).446 Dim(a&Attr(tcell.AttrDim) != 0).447 Reverse(a&Attr(tcell.AttrReverse) != 0).448 Underline(a&Attr(tcell.AttrUnderline) != 0)457 Dim(a&Attr(tcell.AttrDim) != 0)458459 for {460 if len(t) == 0 {461 break
31 unmodified lines
493494func (w *Window) FillString(text string, pair ColorPair, a Attr) bool {495 lx := 0496488 //TODO: respect attr489 style := pair.style().497 var style tcell.Style498 if _color {499 style = pair.style()500 } else {501 style = ColDefault.style()502 }503 style = style.504 Blink(a&Attr(tcell.AttrBlink) != 0).505 Bold(a&Attr(tcell.AttrBold) != 0).506 Dim(a&Attr(tcell.AttrDim) != 0).507 Reverse(a&Attr(tcell.AttrReverse) != 0).
42 unmodified lines
550 right := left + w.Width551 top := w.Top552 bot := top + w.Height553554 var style tcell.Style555 if _color {540 style := ColBorder.style()556 style = ColBorder.style()557 } else {558 style = ColDefault.style()559 }560561 for x := left; x < right; x++ {562 _screen.SetContent(x, top, tcell.RuneHLine, nil, style)563 _screen.SetContent(x, bot-1, tcell.RuneHLine, nil, style)
12 unmodified lines