diff options
Diffstat (limited to 'src/tui/tcell.go')
-rw-r--r-- | src/tui/tcell.go | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/tui/tcell.go b/src/tui/tcell.go index bed52801..7db37c4c 100644 --- a/src/tui/tcell.go +++ b/src/tui/tcell.go @@ -172,10 +172,6 @@ func (r *FullscreenRenderer) DoesAutoWrap() bool { return false } -func (r *FullscreenRenderer) IsOptimized() bool { - return false -} - func (r *FullscreenRenderer) Clear() { _screen.Sync() _screen.Clear() @@ -409,14 +405,13 @@ func (w *TcellWindow) Close() { func fill(x, y, w, h int, r rune) { for ly := 0; ly <= h; ly++ { for lx := 0; lx <= w; lx++ { - _screen.SetContent(x+lx, y+ly, r, nil, ColDefault.style()) + _screen.SetContent(x+lx, y+ly, r, nil, ColNormal.style()) } } } func (w *TcellWindow) Erase() { - // TODO - fill(w.left, w.top, w.width, w.height, ' ') + fill(w.left-1, w.top, w.width+1, w.height, ' ') } func (w *TcellWindow) Enclose(y int, x int) bool { @@ -433,13 +428,13 @@ func (w *TcellWindow) Move(y int, x int) { func (w *TcellWindow) MoveAndClear(y int, x int) { w.Move(y, x) for i := w.lastX; i < w.width; i++ { - _screen.SetContent(i+w.left, w.lastY+w.top, rune(' '), nil, ColDefault.style()) + _screen.SetContent(i+w.left, w.lastY+w.top, rune(' '), nil, ColNormal.style()) } w.lastX = x } func (w *TcellWindow) Print(text string) { - w.printString(text, ColDefault, 0) + w.printString(text, ColNormal, 0) } func (w *TcellWindow) printString(text string, pair ColorPair, a Attr) { @@ -452,7 +447,7 @@ func (w *TcellWindow) printString(text string, pair ColorPair, a Attr) { Reverse(a&Attr(tcell.AttrReverse) != 0). Underline(a&Attr(tcell.AttrUnderline) != 0) } else { - style = ColDefault.style(). + style = ColNormal.style(). Reverse(a&Attr(tcell.AttrReverse) != 0 || pair == ColCurrent || pair == ColCurrentMatch). Underline(a&Attr(tcell.AttrUnderline) != 0 || pair == ColMatch || pair == ColCurrentMatch) } @@ -503,7 +498,7 @@ func (w *TcellWindow) fillString(text string, pair ColorPair, a Attr) FillReturn if w.color { style = pair.style() } else { - style = ColDefault.style() + style = ColNormal.style() } style = style. Blink(a&Attr(tcell.AttrBlink) != 0). @@ -543,11 +538,17 @@ func (w *TcellWindow) fillString(text string, pair ColorPair, a Attr) FillReturn } func (w *TcellWindow) Fill(str string) FillReturn { - return w.fillString(str, ColDefault, 0) + return w.fillString(str, ColNormal, 0) } func (w *TcellWindow) CFill(fg Color, bg Color, a Attr, str string) FillReturn { - return w.fillString(str, ColorPair{fg, bg, -1}, a) + if fg == colDefault { + fg = ColNormal.Fg() + } + if bg == colDefault { + bg = ColNormal.Bg() + } + return w.fillString(str, NewColorPair(fg, bg), a) } func (w *TcellWindow) drawBorder(around bool) { @@ -560,7 +561,7 @@ func (w *TcellWindow) drawBorder(around bool) { if w.color { style = ColBorder.style() } else { - style = ColDefault.style() + style = ColNormal.style() } for x := left; x < right; x++ { |