diff options
| author | 莊喬 <bootleq@gmail.com> | 2023-02-19 18:08:46 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-19 11:08:46 +0100 |
| commit | b0395c2882dbc7412edad9888794de131ad6e365 (patch) | |
| tree | 20c8b8cba7bc633dc2ac171c39d98247fa4bcc56 /lua | |
| parent | ee90403e4039cc59227d88bf71755d9227305cf3 (diff) | |
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.
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/make_entry.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index 35011aa..272524b 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -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), |
