Skip to content

Commit 0edb5d5

Browse files
committed
Fix trailing ␊ not rendered with '--read0 --no-multi-line'
#4334 (comment) # Should display foo␊ echo -en "foo\n" | fzf --read0 --no-multi-line
1 parent 9ffc2c7 commit 0edb5d5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Diff for: src/terminal.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3144,7 +3144,7 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
31443144
wasWrapped = true
31453145
}
31463146

3147-
if len(line) > 0 && line[len(line)-1] == '\n' {
3147+
if len(line) > 0 && line[len(line)-1] == '\n' && lineOffset < len(lines)-1 {
31483148
line = line[:len(line)-1]
31493149
} else {
31503150
wrapped = true

Diff for: test/test_core.rb

+5
Original file line numberDiff line numberDiff line change
@@ -1931,4 +1931,9 @@ def test_change_header_on_header_window
19311931
tmux.send_keys :Space
19321932
tmux.until { |lines| assert lines.any_include?('bar') }
19331933
end
1934+
1935+
def test_trailing_new_line
1936+
tmux.send_keys %(echo -en "foo\n" | fzf --read0 --no-multi-line), :Enter
1937+
tmux.until { |lines| assert_includes lines, '> foo␊' }
1938+
end
19341939
end

0 commit comments

Comments
 (0)