diff --git a/lua/high-str/tools/tool-exportimport/export.lua b/lua/high-str/tools/tool-exportimport/export.lua index f757be7..636eebb 100644 --- a/lua/high-str/tools/tool-exportimport/export.lua +++ b/lua/high-str/tools/tool-exportimport/export.lua @@ -93,7 +93,7 @@ function M.export() local file_cords = import.load_file(opts.saving_path .. "cords.txt") or {} local final_cords = {} - if (next(file_cords) ~= nil) then + if (file_cords ~= 0 and next(file_cords) ~= nil) then final_cords = vim.tbl_deep_extend("force", file_cords, cords) for file, _ in pairs(final_cords) do for local_file, _ in pairs(cords) do diff --git a/lua/high-str/tools/tool-highlight/modules/highlight_selection.lua b/lua/high-str/tools/tool-highlight/modules/highlight_selection.lua index cabe75c..7e4c346 100644 --- a/lua/high-str/tools/tool-highlight/modules/highlight_selection.lua +++ b/lua/high-str/tools/tool-highlight/modules/highlight_selection.lua @@ -55,6 +55,11 @@ function M.highlight_visual_selection(hi_group, beg_line, beg_col, end_line, end ) if (beg_line == end_line) then + -- After import, highlight is triggered with line 0 + -- Somehow, the command cannot be removed, but we can catch the exception here + if (beg_line == 0) then + return + end api.nvim_buf_add_highlight(current_buffer, 0, hi_group, beg_line - 1, beg_col, end_col) else -- api.nvim_buf_clear_namespace(current_buffer, 0, beg_line - 1, beg_line)