From c46b6688f0fa1331c7e4b13b32fcba3826aa956a Mon Sep 17 00:00:00 2001 From: Jaehwang Jung <tomtomjhj@gmail.com> Date: Thu, 16 Jun 2022 03:25:22 +0900 Subject: [PATCH] Reserve slots with `false` --- lua/cmp_buffer/buffer.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/cmp_buffer/buffer.lua b/lua/cmp_buffer/buffer.lua index 0310df2..d0ed285 100644 --- a/lua/cmp_buffer/buffer.lua +++ b/lua/cmp_buffer/buffer.lua @@ -13,7 +13,7 @@ end ---@field public timer cmp_buffer.Timer ---@field public lines_count number ---@field public timer_current_line number ----@field public lines_words table<number, string[]> +---@field public lines_words table<number, false|string[]> ---@field public unique_words_curr_line table<string, boolean> ---@field public unique_words_other_lines table<string, boolean> ---@field public unique_words_curr_line_dirty boolean @@ -215,7 +215,7 @@ function buffer.watch(self) -- (which is why I am concerned about preallocation). Why is there no -- built-in function to do this in Lua??? for i = old_lines_count + 1, new_lines_count do - self.lines_words[i] = vim.NIL + self.lines_words[i] = false end -- Move forwards the unchanged elements in the tail part. for i = old_lines_count, old_last_line + 1, -1 do