aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/diagnostic.lua
diff options
context:
space:
mode:
authorMatthew Toohey <contact@mtoohey.com>2021-12-05 21:39:00 -0500
committerGitHub <noreply@github.com>2021-12-05 19:39:00 -0700
commit62f0157853c0363d47466d06c6548dbd96d9b39c (patch)
tree673b0ee9f18eac50b8fd3b7bd5391b9ef4aa83d1 /runtime/lua/vim/diagnostic.lua
parent24f9463dd07abc5953e01d3a5ca52b734544b471 (diff)
downloadrneovim-62f0157853c0363d47466d06c6548dbd96d9b39c.tar.gz
rneovim-62f0157853c0363d47466d06c6548dbd96d9b39c.tar.bz2
rneovim-62f0157853c0363d47466d06c6548dbd96d9b39c.zip
fix(diagnostic): escape special chars in file names (#16527)
Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Gregory Anders <greg@gpanders.com>
Diffstat (limited to 'runtime/lua/vim/diagnostic.lua')
-rw-r--r--runtime/lua/vim/diagnostic.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 708ee1727a..2973f293f3 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -658,7 +658,10 @@ function M.set(namespace, bufnr, diagnostics, opts)
vim.api.nvim_buf_call(bufnr, function()
vim.api.nvim_command(
- string.format("doautocmd <nomodeline> DiagnosticChanged %s", vim.api.nvim_buf_get_name(bufnr))
+ string.format(
+ "doautocmd <nomodeline> DiagnosticChanged %s",
+ vim.fn.fnameescape(vim.api.nvim_buf_get_name(bufnr))
+ )
)
end)
end
@@ -1333,7 +1336,7 @@ function M.reset(namespace, bufnr)
end
vim.api.nvim_command(
- string.format("doautocmd <nomodeline> DiagnosticChanged %s", vim.api.nvim_buf_get_name(bufnr))
+ string.format("doautocmd <nomodeline> DiagnosticChanged %s", vim.fn.fnameescape(vim.api.nvim_buf_get_name(bufnr)))
)
end