diff --git a/lua/avante/utils/init.lua b/lua/avante/utils/init.lua index 810f1aa..1e0e913 100644 --- a/lua/avante/utils/init.lua +++ b/lua/avante/utils/init.lua @@ -736,7 +736,11 @@ end ---@return string[] A new list of strings with line numbers prepended. function M.prepend_line_numbers(lines, start_line) start_line = start_line or 1 - return vim.iter(lines):map(function(line, i) return string.format("L%d: %s", i + start_line, line) end):totable() + return vim + .iter(lines) + :enumerate() + :map(function(i, line) return string.format("L%d: %s", i + start_line, line) end) + :totable() end ---Iterates through a list of strings and removes prefixes in form of "L: " from them @@ -756,7 +760,7 @@ function M.debounce(func, delay) return function(...) local args = { ... } - if timer then + if timer and not timer:is_closing() then timer:stop() timer:close() end