fix(view): backward compat for older Neovim versions. Fixes #1489

This commit is contained in:
Folke Lemaitre 2024-05-31 13:55:54 +02:00
parent 24fa2a9708
commit 917dfbe2a9
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 5 additions and 2 deletions

View File

@ -297,11 +297,14 @@ function M:setup_modes()
end
if m.key_plugin and name ~= "restore" then
self:on_key(m.key_plugin, function()
vim.api.nvim_feedkeys(vim.keycode("<esc>"), "n", false)
local esc = vim.api.nvim_replace_termcodes("<esc>", true, true, true)
vim.api.nvim_feedkeys(esc, "n", false)
local plugins = {}
if vim.api.nvim_get_mode().mode:lower() == "v" then
local f, t = vim.fn.line("."), vim.fn.line("v")
if f > t then f, t = t, f end
if f > t then
f, t = t, f
end
for i = f, t do
plugins[#plugins + 1] = self.render:get_plugin(i)
end