fix: avoid eval "= directly in builtin registers picker (#2347)
When "= contains expression not ought to be run in current context, the
`getreg('=')` raises error.
For example `:put =foo` (where `foo` is undefined) then open registers
picker it fails. Also #2228.
Now specify second arg to `getreg` to get register expr (instead of
"evaluated" result) as content, like what `:registers` command displays.
This has behavior change, if user still want to see/paste the
evaluated result, a customized action will be needed.
This commit is contained in:
@@ -820,7 +820,7 @@ function make_entry.gen_from_registers(opts)
|
||||
end
|
||||
|
||||
return function(entry)
|
||||
local contents = vim.fn.getreg(entry)
|
||||
local contents = vim.fn.getreg(entry, 1)
|
||||
return make_entry.set_default_entry_mt({
|
||||
value = entry,
|
||||
ordinal = string.format("%s %s", entry, contents),
|
||||
|
||||
Reference in New Issue
Block a user