Skip to content

Commit 60da032

Browse files
author
cht
committed
fix the finally bug
* delete the right buf * add key to rm overflow temp
1 parent 80a3756 commit 60da032

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

lua/csvtools.lua

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ local function getrangeoverflow(line, length)
8686
end
8787
return start, final
8888
end
89+
function M.CloseOverFlow()
90+
if M.showoverflow then
91+
for count = 1, #Status.overflowtext do
92+
--print(Status.overflowtext[count].bnr,Status.overflowtext[count].ns_id,Status.overflowtext[count].id)
93+
vim.api.nvim_buf_del_extmark(
94+
Status.overflowtext[count].bnr,
95+
Status.overflowtext[count].ns_id,
96+
Status.overflowtext[count].id
97+
)
98+
end
99+
end
100+
end
89101
function M.Highlight()
90102
if vim.o.filetype == "csv" then
91103
Status.header = getheader.Header()
@@ -139,7 +151,7 @@ end
139151
function M.deleteMark()
140152
if M.showoverflow then
141153
vim.api.nvim_buf_del_extmark(
142-
Status.overflowtext[1].markid,
154+
Status.overflowtext[1].bnr,
143155
Status.overflowtext[1].ns_id,
144156
Status.overflowtext[1].id
145157
)
@@ -153,6 +165,7 @@ function M.add_mappings()
153165
vim.api.nvim_buf_set_keymap(M.mainwindowbuf, "n", "<leader>tf", ":lua require'csvtools'.NewWindow()<cr>", opts)
154166
vim.api.nvim_buf_set_keymap(M.buf, "n", "<leader>td", ":lua require'csvtools'.CloseWindow()<cr>", opts)
155167
vim.api.nvim_buf_set_keymap(M.mainwindowbuf, "n", "<leader>td", ":lua require'csvtools'.CloseWindow()<cr>", opts)
168+
vim.api.nvim_buf_set_keymap(M.mainwindowbuf, "n", "<leader>tr", ":lua require'csvtools'.CloseOverFlow()<cr>", opts)
156169
vim.api.nvim_buf_set_keymap(M.mainwindowbuf, "n", "<leader>tg", ":lua require'csvtools'.Ifclear()<cr>", opts)
157170
vim.api.nvim_buf_set_keymap(M.mainwindowbuf, "n", "<up>", ":-1<cr>:lua require'csvtools'.Highlight()<cr>", opts)
158171
vim.api.nvim_buf_set_keymap(M.mainwindowbuf, "n", "k", ":-1<cr>:lua require'csvtools'.Highlight()<cr>", opts)

lua/csvtools/overflowtext.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function M.OverFlow(line_num, header, id)
4949
--highlighttop2(bnr, text)
5050
--print("sss")
5151
return {
52+
bnr = bnr,
5253
markid = vim.api.nvim_buf_set_extmark(bnr, ns_id, line_num - 1, 0, opts),
5354
ns_id = ns_id,
5455
id = id,
@@ -96,6 +97,7 @@ function M.OverFlowTitle(line_num, header, id)
9697
--highlighttop2(bnr, text)
9798
--print("sss")
9899
return {
100+
bnr = bnr,
99101
markid = vim.api.nvim_buf_set_extmark(bnr, ns_id, line_num - 1, 0, opts),
100102
ns_id = ns_id,
101103
id = id,

0 commit comments

Comments
 (0)