Skip to content

Commit bea6f20

Browse files
fix: skip updates when state is disabled
## Details Issue: #208 When state is disabled the update logic is still triggered. For the most part this doesn't really do anything as it triggers the non rendered view. However it does hijack the window options and prevents users from changing them by constantly changing them back. To fix this gate the event based callbacks on state being enabled. The only case where state is disabled in the UI is from user commands.
1 parent 2f36ac1 commit bea6f20

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lua/render-markdown/health.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ local state = require('render-markdown.state')
44
local M = {}
55

66
---@private
7-
M.version = '7.4.1'
7+
M.version = '7.4.2'
88

99
function M.check()
1010
M.start('version')

lua/render-markdown/manager.lua

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ function M.setup()
2525
vim.api.nvim_create_autocmd('WinResized', {
2626
group = M.group,
2727
callback = function(args)
28+
if not state.enabled then
29+
return
30+
end
2831
for _, win in ipairs(vim.v.event.windows) do
2932
local buf = vim.fn.winbufnr(win)
3033
if vim.tbl_contains(buffers, buf) then
@@ -65,6 +68,9 @@ function M.attach(buf)
6568
group = M.group,
6669
buffer = buf,
6770
callback = function(args)
71+
if not state.enabled then
72+
return
73+
end
6874
local event, win = args.event, vim.api.nvim_get_current_win()
6975
if buf == vim.fn.winbufnr(win) then
7076
ui.debounce_update(buf, win, event, vim.tbl_contains(change_events, event))

0 commit comments

Comments
 (0)