Skip to content

Commit

Permalink
fix: schedule setting buffer modifiable
Browse files Browse the repository at this point in the history
fixes #17
  • Loading branch information
b0o committed Apr 12, 2024
1 parent 0af84e5 commit 7e00951
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/nui-components/component/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,13 @@ function Component:initial_value()
end

function Component:modify_buffer_content(modify_fn)
self:set_buffer_option("modifiable", true)
vim.schedule(function()
modify_fn()
self:set_buffer_option("modifiable", true)
vim.schedule(function()
self:set_buffer_option("modifiable", false)
modify_fn()
vim.schedule(function()
self:set_buffer_option("modifiable", false)
end)
end)
end)
end
Expand Down

0 comments on commit 7e00951

Please sign in to comment.