Skip to content

Commit

Permalink
fix the problem of last head cannot git
Browse files Browse the repository at this point in the history
  • Loading branch information
cht committed Feb 17, 2022
1 parent 4ab699f commit ff2e6b7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/csvtools/header.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ local M = {}
function M.Header()
local line = unpack(vim.api.nvim_buf_get_lines(0, 0, 1, true))
local header = {}
local cout = 1
local length = 0
for i = 1, #line do
if line:sub(i, i) ~= "," then
length = length + 1
else
table.insert(header, length)
length = 0
cout = cout + 1
end
end
-- fixbug
if length ~= 0 then
table.insert(header, length)
end
return header
end
return M

0 comments on commit ff2e6b7

Please sign in to comment.