Skip to content

Commit 5063384

Browse files
authored
fix(previewer): remove unexpected trailing blank line (#3653)
There will be a blank line in the previewer buffer if the file ends with a line feed. Since Neovim treats `\n` (or `\r\n`) as the "line terminator" instead of the "line separator", the previewer buffer should be consistent with the standard behavior. This removes the last empty string from the split result to fix that.
1 parent 028d9a0 commit 5063384

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lua/telescope/previewers/buffer_previewer.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ local function split(s, sep, plain, opts)
7474
end
7575
end
7676
end
77+
if t[#t] == "" then
78+
t[#t] = nil
79+
end
7780
return t
7881
end
7982
local bytes_to_megabytes = math.pow(1024, 2)

0 commit comments

Comments
 (0)