From 81401353dc13ff87f4879b6e0b5f96ff2de14d9c Mon Sep 17 00:00:00 2001 From: Ben Lubas <56943754+benlubas@users.noreply.github.com> Date: Tue, 28 May 2024 13:46:50 -0400 Subject: [PATCH] fix(latex-renderer): handle broken latex (#1438) --- .../modules/core/latex/renderer/module.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lua/neorg/modules/core/latex/renderer/module.lua b/lua/neorg/modules/core/latex/renderer/module.lua index 343dafa99..052ec4e6f 100644 --- a/lua/neorg/modules/core/latex/renderer/module.lua +++ b/lua/neorg/modules/core/latex/renderer/module.lua @@ -403,13 +403,16 @@ local function render_latex() render_timer = nil if not running_proc then - running_proc = nio.run(function() - nio.scheduler() - module.public.async_latex_renderer(buf) - end, function() - module.public.render_inline_math(module.private.latex_images[buf] or {}, buf) - running_proc = nil - end) + running_proc = nio.run( + function() + nio.scheduler() + module.public.async_latex_renderer(buf) + end, + vim.schedule_wrap(function() + module.public.render_inline_math(module.private.latex_images[buf] or {}, buf) + running_proc = nil + end) + ) end end) end