summaryrefslogtreecommitdiff
path: root/test/test_layout.rb
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-05-17 11:24:53 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-05-17 11:25:15 +0900
commitb27943423e1cde31a7f27c7b031d7fa108cf9c14 (patch)
treeb7feebbd92669131ea8af730dd8c62c2b71f7344 /test/test_layout.rb
parent894a1016bccfcb3c68707b798a73e99b78e97bd4 (diff)
downloadfzf-b27943423e1cde31a7f27c7b031d7fa108cf9c14.tar.gz
Show ellipsis for truncated labels
Close #4390
Diffstat (limited to 'test/test_layout.rb')
-rw-r--r--test/test_layout.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/test_layout.rb b/test/test_layout.rb
index ed384712..8aa412d5 100644
--- a/test/test_layout.rb
+++ b/test/test_layout.rb
@@ -992,6 +992,36 @@ class TestLayout < TestInteractive
tmux.until { assert_block(block, it) }
end
+ def test_label_trunction
+ command = <<~CMD
+ seq 10 | #{FZF} --style full --border --header-lines=1 --preview ':' \\
+ --border-label "#{'b' * 1000}" \\
+ --preview-label "#{'p' * 1000}" \\
+ --header-label "#{'h' * 1000}" \\
+ --header-label "#{'h' * 1000}" \\
+ --input-label "#{'i' * 1000}" \\
+ --list-label "#{'l' * 1000}"
+ CMD
+ writelines(command.lines.map(&:chomp))
+ tmux.send_keys("sh #{tempname}", :Enter)
+ tmux.until do |lines|
+ text = lines.join
+ assert_includes text, 'b··'
+ assert_includes text, 'l··p'
+ assert_includes text, 'p··'
+ assert_includes text, 'h··'
+ assert_includes text, 'i··'
+ end
+ end
+
+ def test_separator_no_ellipsis
+ tmux.send_keys %(seq 10 | #{FZF} --separator "$(seq 1000 | tr '\\n' ' ')"), :Enter
+ tmux.until do |lines|
+ assert_equal 10, lines.match_count
+ refute_includes lines.join, '··'
+ end
+ end
+
def test_header_border_no_pointer_and_marker
tmux.send_keys %(seq 10 | #{FZF} --header-lines 1 --header-border sharp --no-list-border --pointer '' --marker ''), :Enter
block = <<~BLOCK