mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-06 23:22:04 -07:00
Fix extra new line in the preview window
When a colored text ends at the right end of the window Fix #3209
This commit is contained in:
@@ -1828,12 +1828,14 @@ func (t *Terminal) renderPreviewText(height int, lines []string, lineNo int, unc
|
||||
trimmed, isTrimmed = t.trimRight(trimmed, maxWidth-t.pwindow.X())
|
||||
}
|
||||
str, width := t.processTabs(trimmed, prefixWidth)
|
||||
prefixWidth += width
|
||||
if t.theme.Colored && ansi != nil && ansi.colored() {
|
||||
lbg = ansi.lbg
|
||||
fillRet = t.pwindow.CFill(ansi.fg, ansi.bg, ansi.attr, str)
|
||||
} else {
|
||||
fillRet = t.pwindow.CFill(tui.ColPreview.Fg(), tui.ColPreview.Bg(), tui.AttrRegular, str)
|
||||
if width > prefixWidth {
|
||||
prefixWidth = width
|
||||
if t.theme.Colored && ansi != nil && ansi.colored() {
|
||||
lbg = ansi.lbg
|
||||
fillRet = t.pwindow.CFill(ansi.fg, ansi.bg, ansi.attr, str)
|
||||
} else {
|
||||
fillRet = t.pwindow.CFill(tui.ColPreview.Fg(), tui.ColPreview.Bg(), tui.AttrRegular, str)
|
||||
}
|
||||
}
|
||||
return !isTrimmed &&
|
||||
(fillRet == tui.FillContinue || t.previewOpts.wrap && fillRet == tui.FillNextLine)
|
||||
|
Reference in New Issue
Block a user