diff --git a/src/terminal.go b/src/terminal.go index e450d657..71e7ed2c 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -3807,7 +3807,7 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat offs[idx].offset[1] = util.Min32(offset.offset[1], int32(maxWidth)) } } - displayWidth = t.displayWidthWithLimit(runes, 0, displayWidth) + displayWidth = t.displayWidthWithLimit(runes, 0, maxWidth) } displayWidthSum += displayWidth diff --git a/test/test_core.rb b/test/test_core.rb index d5540d96..697133dd 100644 --- a/test/test_core.rb +++ b/test/test_core.rb @@ -1235,6 +1235,16 @@ class TestCore < TestInteractive end end + def test_freeze_right_with_ellipsis_and_scrolling + tmux.send_keys "{ seq 6; ruby -e 'print \"g\"*1000, \"\\n\"'; seq 8 100; } | #{FZF} --ellipsis='777' --freeze-right 1 --scroll-off 0 --bind a:offset-up", :Enter + tmux.until { |lines| assert_equal ' 100/100', lines[-2] } + tmux.send_keys(*Array.new(6) { :a }) + tmux.until do |lines| + assert_match(/> 777g+$/, lines[-3]) + assert_equal 1, lines.count { |l| l.end_with?('g') } + end + end + def test_backward_eof tmux.send_keys "echo foo | #{FZF} --bind 'backward-eof:reload(seq 100)'", :Enter tmux.until { |lines| lines.item_count == 1 && lines.match_count == 1 }