mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-25 14:17:40 +00:00
parent
5624a89231
commit
5d16b28869
@ -1036,12 +1036,14 @@ func (t *Terminal) printPreview() {
|
|||||||
break
|
break
|
||||||
} else if lineNo > 0 {
|
} else if lineNo > 0 {
|
||||||
var fillRet tui.FillReturn
|
var fillRet tui.FillReturn
|
||||||
|
prefixWidth := 0
|
||||||
_, _, ansi = extractColor(line, ansi, func(str string, ansi *ansiState) bool {
|
_, _, ansi = extractColor(line, ansi, func(str string, ansi *ansiState) bool {
|
||||||
trimmed := []rune(str)
|
trimmed := []rune(str)
|
||||||
if !t.preview.wrap {
|
if !t.preview.wrap {
|
||||||
trimmed, _ = t.trimRight(trimmed, maxWidth-t.pwindow.X())
|
trimmed, _ = t.trimRight(trimmed, maxWidth-t.pwindow.X())
|
||||||
}
|
}
|
||||||
str, _ = t.processTabs(trimmed, 0)
|
str, width := t.processTabs(trimmed, prefixWidth)
|
||||||
|
prefixWidth += width
|
||||||
if t.theme != nil && ansi != nil && ansi.colored() {
|
if t.theme != nil && ansi != nil && ansi.colored() {
|
||||||
fillRet = t.pwindow.CFill(ansi.fg, ansi.bg, ansi.attr, str)
|
fillRet = t.pwindow.CFill(ansi.fg, ansi.bg, ansi.attr, str)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1532,6 +1532,12 @@ class TestGoFZF < TestBase
|
|||||||
tmux.until { |lines| lines[-4] == ' b' }
|
tmux.until { |lines| lines[-4] == ' b' }
|
||||||
tmux.until { |lines| lines[-5] == ' ccc' }
|
tmux.until { |lines| lines[-5] == ' ccc' }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_preview_correct_tab_width_after_ansi_reset_code
|
||||||
|
writelines tempname, ["\x1b[31m+\x1b[m\t\x1b[32mgreen"]
|
||||||
|
tmux.send_keys "#{FZF} --preview 'cat #{tempname}'", :Enter
|
||||||
|
tmux.until { |lines| lines[1].include?('+ green') }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module TestShell
|
module TestShell
|
||||||
|
Loading…
Reference in New Issue
Block a user