From 9110a1a49903867b4446e2f6b54c8b1e73e7bc8e Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 20 Feb 2026 20:23:32 -0500 Subject: [PATCH] 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 --- lua/oil/view.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/oil/view.lua b/lua/oil/view.lua index 973b949..2db8942 100644 --- a/lua/oil/view.lua +++ b/lua/oil/view.lua @@ -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