api: Make sure dict_set_var doesn’t edit read-only values

Fixes #6147
This commit is contained in:
ZyX
2017-02-23 01:34:25 +03:00
parent 8faa4af396
commit 858ac9d8e5
7 changed files with 61 additions and 8 deletions

View File

@@ -534,6 +534,14 @@ local function skip_fragile(pending_fn, cond)
return false
end
local function meth_pcall(...)
local ret = {pcall(...)}
if type(ret[2]) == 'string' then
ret[2] = ret[2]:gsub('^[^:]+:%d+: ', '')
end
return ret
end
local funcs = create_callindex(nvim_call)
local meths = create_callindex(nvim)
local uimeths = create_callindex(ui)
@@ -604,6 +612,7 @@ local M = {
skip_fragile = skip_fragile,
set_shell_powershell = set_shell_powershell,
tmpname = tmpname,
meth_pcall = meth_pcall,
NIL = mpack.NIL,
}