Fix preview window of tcell renderer

This commit is contained in:
Junegunn Choi 2020-10-25 21:43:53 +09:00
parent 11841f688b
commit 9b946f2b7a
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -515,8 +515,9 @@ func (w *TcellWindow) CPrint(pair ColorPair, text string) {
w.printString(text, pair)
}
func (w *TcellWindow) fillString(text string, pair ColorPair, a Attr) FillReturn {
func (w *TcellWindow) fillString(text string, pair ColorPair) FillReturn {
lx := 0
a := pair.Attr()
var style tcell.Style
if w.color {
@ -558,12 +559,17 @@ func (w *TcellWindow) fillString(text string, pair ColorPair, a Attr) FillReturn
}
}
w.lastX += lx
if w.lastX == w.width {
w.lastY++
w.lastX = 0
return FillNextLine
}
return FillContinue
}
func (w *TcellWindow) Fill(str string) FillReturn {
return w.fillString(str, w.normal, 0)
return w.fillString(str, w.normal)
}
func (w *TcellWindow) CFill(fg Color, bg Color, a Attr, str string) FillReturn {
@ -573,7 +579,7 @@ func (w *TcellWindow) CFill(fg Color, bg Color, a Attr, str string) FillReturn {
if bg == colDefault {
bg = w.normal.Bg()
}
return w.fillString(str, NewColorPair(fg, bg, a), a)
return w.fillString(str, NewColorPair(fg, bg, a))
}
func (w *TcellWindow) drawBorder() {