Skip to content

Commit

Permalink
fix the finally bug
Browse files Browse the repository at this point in the history
* delete the right buf
* add key to rm overflow temp
  • Loading branch information
cht committed Feb 17, 2022
1 parent 80a3756 commit 60da032
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lua/csvtools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ local function getrangeoverflow(line, length)
end
return start, final
end
function M.CloseOverFlow()
if M.showoverflow then
for count = 1, #Status.overflowtext do
--print(Status.overflowtext[count].bnr,Status.overflowtext[count].ns_id,Status.overflowtext[count].id)
vim.api.nvim_buf_del_extmark(
Status.overflowtext[count].bnr,
Status.overflowtext[count].ns_id,
Status.overflowtext[count].id
)
end
end
end
function M.Highlight()
if vim.o.filetype == "csv" then
Status.header = getheader.Header()
Expand Down Expand Up @@ -139,7 +151,7 @@ end
function M.deleteMark()
if M.showoverflow then
vim.api.nvim_buf_del_extmark(
Status.overflowtext[1].markid,
Status.overflowtext[1].bnr,
Status.overflowtext[1].ns_id,
Status.overflowtext[1].id
)
Expand All @@ -153,6 +165,7 @@ function M.add_mappings()
vim.api.nvim_buf_set_keymap(M.mainwindowbuf, "n", "<leader>tf", ":lua require'csvtools'.NewWindow()<cr>", opts)
vim.api.nvim_buf_set_keymap(M.buf, "n", "<leader>td", ":lua require'csvtools'.CloseWindow()<cr>", opts)
vim.api.nvim_buf_set_keymap(M.mainwindowbuf, "n", "<leader>td", ":lua require'csvtools'.CloseWindow()<cr>", opts)
vim.api.nvim_buf_set_keymap(M.mainwindowbuf, "n", "<leader>tr", ":lua require'csvtools'.CloseOverFlow()<cr>", opts)
vim.api.nvim_buf_set_keymap(M.mainwindowbuf, "n", "<leader>tg", ":lua require'csvtools'.Ifclear()<cr>", opts)
vim.api.nvim_buf_set_keymap(M.mainwindowbuf, "n", "<up>", ":-1<cr>:lua require'csvtools'.Highlight()<cr>", opts)
vim.api.nvim_buf_set_keymap(M.mainwindowbuf, "n", "k", ":-1<cr>:lua require'csvtools'.Highlight()<cr>", opts)
Expand Down
2 changes: 2 additions & 0 deletions lua/csvtools/overflowtext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function M.OverFlow(line_num, header, id)
--highlighttop2(bnr, text)
--print("sss")
return {
bnr = bnr,
markid = vim.api.nvim_buf_set_extmark(bnr, ns_id, line_num - 1, 0, opts),
ns_id = ns_id,
id = id,
Expand Down Expand Up @@ -96,6 +97,7 @@ function M.OverFlowTitle(line_num, header, id)
--highlighttop2(bnr, text)
--print("sss")
return {
bnr = bnr,
markid = vim.api.nvim_buf_set_extmark(bnr, ns_id, line_num - 1, 0, opts),
ns_id = ns_id,
id = id,
Expand Down

0 comments on commit 60da032

Please sign in to comment.