Skip to content
Myr

--no-color: Keep ANSI attributes in preview window

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

Example: fzf --preview 'echo -e "\x1b[33;3mfoo \x1b[34;4mbar\x1b[m baz"' --no-color

authored by Junegunn Choi · committed by Junegunn Choi · parent 1721e6a · Browse files · 1 file+7 added−2 removed
This commit

State

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

Trailers

  • Example: fzf --preview 'echo -e "\x1b[33;3mfoo \x1b[34;4mbar\x1b[m baz"' --no-color

Diff stats

1 file+7 added−2 removed

  • other:+7 added−2 removed

1 file+7 added−2 removed

modified:src/terminal.go+7 added-2 removed
3557 unmodified lines
3558 }3559 str, width := t.processTabs(trimmed, prefixWidth)3560 if width > prefixWidth {3561 prefixWidth = width3562 if t.theme.Colored && ansi != nil && ansi.colored() {3562 colored := ansi != nil && ansi.colored()3563 if t.theme.Colored && colored {3564 fillRet = t.pwindow.CFill(ansi.fg, ansi.bg, ansi.attr, str)3565 } else {3566 attr := tui.AttrRegular3567 if colored {3568 attr = ansi.attr3569 }3565 fillRet = t.pwindow.CFill(tui.ColPreview.Fg(), tui.ColPreview.Bg(), tui.AttrRegular, str)3570 fillRet = t.pwindow.CFill(tui.ColPreview.Fg(), tui.ColPreview.Bg(), attr, str)3571 }3572 }3573 return !isTrimmed &&3574 (fillRet == tui.FillContinue || t.activePreviewOpts.wrap && fillRet == tui.FillNextLine)
2847 unmodified lines