diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2021-11-22 20:48:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-22 20:48:37 +0100 |
| commit | 6daf35c88c07dd4b220468968a742cda04889cd3 (patch) | |
| tree | 3f038291a7fda4555bcfb4891b5ea37b4542acc7 /lua/telescope/mappings.lua | |
| parent | 6f82c6630cea83b591beeebdc760705cafa3e426 (diff) | |
fix: action mt so we can again concat actions from two different tables (#1143)
* fix: action mt so we can again concat actions from two different tables
- without actually changing the public interface
- without having a local table that keeps track of all actions
* this should clear actions now
we never actually called this function which is kinda a problem because
we never cleaned up previous mapping stores.
We can also make a better mappings store which has access to the keys
sequences which would help the showing actions part
* bugfix
* that should now clear everything
only tests left i think
* more tests
* cleanup
* hack: make sure all actions get cleared
Diffstat (limited to 'lua/telescope/mappings.lua')
| -rw-r--r-- | lua/telescope/mappings.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lua/telescope/mappings.lua b/lua/telescope/mappings.lua index 27e5d07..b78923f 100644 --- a/lua/telescope/mappings.lua +++ b/lua/telescope/mappings.lua @@ -221,10 +221,6 @@ mappings.apply_keymap = function(prompt_bufnr, attach_mappings, buffer_keymap) end end end - - vim.cmd( - string.format([[autocmd BufDelete %s :lua require('telescope.mappings').clear(%s)]], prompt_bufnr, prompt_bufnr) - ) end mappings.execute_keymap = function(prompt_bufnr, keymap_identifier) @@ -237,6 +233,12 @@ mappings.execute_keymap = function(prompt_bufnr, keymap_identifier) end mappings.clear = function(prompt_bufnr) + require("telescope.actions.mt").clear_all() + -- TODO(conni2461): This seems like the better solution but it won't clear actions that were never mapped + -- for _, v in ipairs(keymap_store[prompt_bufnr]) do + -- pcall(v.clear) + -- end + keymap_store[prompt_bufnr] = nil end |
