Fix missing wrap sign at ANSI color boundary

This commit is contained in:
Junegunn Choi
2026-02-19 19:49:13 +09:00
parent 4522868fc0
commit 0ecbf3f475
2 changed files with 38 additions and 1 deletions

View File

@@ -582,4 +582,31 @@ class TestPreview < TestInteractive
assert_equal 1, lines.match_count
end
end
def test_preview_wrap_sign_between_ansi_fragments
tmux.send_keys %(seq 1 | #{FZF} --preview 'echo -e "\\x1b[33m1234567890 \\x1b[mhello"; echo -e "\\x1b[33m1234567890 \\x1b[mhello"' --preview-window 10,wrap-word), :Enter
tmux.until do |lines|
assert_equal 1, lines.match_count
assert_equal 2, lines.count { |line| line.include?('│ 1234567890 │') }
assert_equal 2, lines.count { |line| line.include?('│ ↳ hello │') }
end
end
def test_preview_wrap_sign_between_ansi_fragments_overflow
tmux.send_keys %(seq 1 | #{FZF} --preview 'echo -e "\\x1b[33m1234567890 \\x1b[mhello"; echo -e "\\x1b[33m1234567890 \\x1b[mhello"' --preview-window 2,wrap-word), :Enter
tmux.until do |lines|
assert_equal 1, lines.match_count
assert_equal 2, lines.count { |line| line.include?('│ 12 │') }
assert_equal 0, lines.count { |line| line.include?('│ h') }
end
end
def test_preview_wrap_sign_between_ansi_fragments_overflow2
tmux.send_keys %(seq 1 | #{FZF} --preview 'echo -e "\\x1b[33m1234567890 \\x1b[mhello"; echo -e "\\x1b[33m1234567890 \\x1b[mhello"' --preview-window 1,wrap-word), :Enter
tmux.until do |lines|
assert_equal 1, lines.match_count
assert_equal 2, lines.count { |line| line.include?('│ 1 │') }
assert_equal 0, lines.count { |line| line.include?('│ h') }
end
end
end