Skip to content

Commit

Permalink
add showoverflow session
Browse files Browse the repository at this point in the history
  • Loading branch information
cht committed Feb 16, 2022
1 parent 7718846 commit 84b813c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ should not setup or
require("csvtools").setup({
before = 10,
after = 10,
clearafter = true
clearafter = true,
-- this will clear the highlight of buf after move
showoverflow = true,
-- this will provide a overflow show

})
```

Expand Down
9 changes: 7 additions & 2 deletions lua/csvtools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local M = {
before = 20,
after = 20,
clearafter = true,
showoverflow = true,
overflowtext = {
markid = nil,
ns_id = nil,
Expand Down Expand Up @@ -81,7 +82,9 @@ function M.Highlight()
local start, final = getrange(line, length)
--print(start)
--print(final)
M.overflowtext = overflow.OverFlow(line, M.header)
if M.showoverflow then
M.overflowtext = overflow.OverFlow(line, M.header)
end
for i = start, line, 1 do
highlight.highlight(M.mainwindowbuf, i)
end
Expand All @@ -91,7 +94,9 @@ function M.Highlight()
end
end
function M.deleteMark()
vim.api.nvim_buf_del_extmark(M.overflowtext.markid, M.overflowtext.ns_id, M.overflowtext.id)
if M.showoverflow then
vim.api.nvim_buf_del_extmark(M.overflowtext.markid, M.overflowtext.ns_id, M.overflowtext.id)
end
end
function M.add_mappings()
M.mainwindowbuf = vim.api.nvim_get_current_buf()
Expand Down

0 comments on commit 84b813c

Please sign in to comment.