mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-15 13:17:53 -08:00
fix(cmd): escape special characters in a tip
This commit is contained in:
parent
4e25c7c1c9
commit
c120527696
|
@ -113,10 +113,13 @@ 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')
|
||||
|
||||
-- escape special characters properly, if any
|
||||
command = string.gsub(command, '(\\+)"', '%1%1"')
|
||||
command = string.gsub(command, '(\\+)$', '%1%1')
|
||||
command = string.gsub(command, '"', '\\"')
|
||||
command = string.gsub(command, '([&<>%(%)@%^|])', '^%1')
|
||||
|
||||
local prompt_exe = string.format('%s print tooltip --shell=cmd %s --config=%s --command="%s"', omp_exe(), error_level_option(), omp_config(), command)
|
||||
local tooltip = run_posh_command(prompt_exe)
|
||||
if tooltip ~= "" then
|
||||
|
|
Loading…
Reference in a new issue