From 3c38ac861e1b8d4077ff46a779cde17330b29f3a Mon Sep 17 00:00:00 2001 From: emmanueltouzery Date: Wed, 22 May 2024 22:48:25 +0200 Subject: [PATCH] fix: stuck input control if callback fails (#158) --- lua/dressing/util.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/dressing/util.lua b/lua/dressing/util.lua index 92a244b..3094bf3 100644 --- a/lua/dressing/util.lua +++ b/lua/dressing/util.lua @@ -200,8 +200,10 @@ M.make_queued_async_fn = function(callback_arg_num, fn) args[callback_arg_num] = function(...) local cb_args = vim.F.pack_len(...) vim.schedule(function() - cb(vim.F.unpack_len(cb_args)) + -- first schedule the consumption, only later invoke + -- the callback, because the callback could fail vim.schedule(consume) + cb(vim.F.unpack_len(cb_args)) end) end table.insert(queue, args)