Skip to content

Commit

Permalink
Properly escape
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam committed Oct 6, 2024
1 parent 5aab803 commit 6c07fd0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/lspecho/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ local series = {}
local last_message = ''
local timer = vim.loop.new_timer()

local function escape_string(str)
return str:gsub('([\\"])', '\\%1')
end

local function clear()
timer:stop()
timer:start(
Expand Down Expand Up @@ -57,7 +61,7 @@ local function log(msg)
last_message = out
if M.config.echo then
vim.api.nvim_command(
string.format('redraw | echo "%s"', string.sub(out, 1, vim.v.echospace))
string.format('redraw | echo "%s"', escape_string(string.sub(out, 1, vim.v.echospace)))
)
end
end
Expand Down

0 comments on commit 6c07fd0

Please sign in to comment.