Skip to content

Commit

Permalink
fix: Fixed a bug causing markview to not render on cursor move in lar…
Browse files Browse the repository at this point in the history
…ge files
  • Loading branch information
OXY2DEV committed Aug 25, 2024
1 parent 823a3a2 commit eba9507
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ftplugin/markdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,19 @@ vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
local cached_mode = nil;
local mode_timer = vim.uv.new_timer();

local update_events = { "ModeChanged", "TextChanged" };

if vim.list_contains(markview.configuration.modes, "n") or vim.list_contains(markview.configuration.modes, "v") then
table.insert(update_events, "CursorMoved");
end

if vim.list_contains(markview.configuration.modes, "i") then
table.insert(update_events, "CursorMovedI");
table.insert(update_events, "TextChangedI"); -- For smoother experience when writing, potentially can cause bugs
end

-- ISSUE: Work in progress
vim.api.nvim_create_autocmd({ "ModeChanged", "TextChanged" }, {
vim.api.nvim_create_autocmd(update_events, {
buffer = vim.api.nvim_get_current_buf(),
group = markview_augroup,

Expand Down

0 comments on commit eba9507

Please sign in to comment.