fix(view): strip newlines from symlink target display text

Problem: when a symlink target path contains a newline character, the
rendered line passed to nvim_buf_set_lines includes that newline,
causing the error "'replacement string' item contains newlines".

Solution: apply the same gsub("\n", "") sanitization to meta.link in
get_link_text that is already used for entry names at line 791.

Resolves: stevearc/oil.nvim#673
This commit is contained in:
Barrett Ruth 2026-02-20 20:23:32 -05:00
parent ca834cf703
commit 9110a1a499
Signed by: barrett
GPG key ID: A6C96C9349D2FC81

View file

@ -760,7 +760,7 @@ local function get_link_text(name, meta)
end
if meta.link then
link_text = "-> " .. meta.link
link_text = "-> " .. meta.link:gsub("\n", "")
if meta.link_stat and meta.link_stat.type == "directory" then
link_text = util.addslash(link_text)
end