fix(cmd): escape double quote characters in a tip

This commit is contained in:
L. Yeung 2022-06-17 21:37:20 +08:00 committed by Jan De Dobbeleer
parent 58b8b74e72
commit 6bd8921119

View file

@ -106,6 +106,13 @@ local function get_posh_prompt(rprompt)
end
local function set_posh_tooltip(command)
if command == nil then
return
end
-- escape double quote characters properly, if any
command = string.gsub(command, '\\+"', '%1%1"')
command = string.gsub(command, '\\+$', '%1%1')
command = string.gsub(command, '"', '\\"')
local prompt_exe = string.format('%s print tooltip --shell=cmd --config=%s --command="%s"', omp_exe(), omp_config(), command)
local tooltip = run_posh_command(prompt_exe)
if tooltip ~= "" then