Skip to content

Commit

Permalink
Merge pull request #25 from amedama41/issue/git_status
Browse files Browse the repository at this point in the history
  • Loading branch information
obaland committed Sep 10, 2023
2 parents 2aa2942 + 5dbe2af commit 0edad19
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion lua/vfiler/libs/async/jobs/job_nvim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,19 @@ function Job:start(command, options)
end
end,
}
local data_buffer = ''
if options.on_received then
jobopts.on_stdout = function(channel, datas, name)
for _, data in ipairs(datas) do
datas[1] = data_buffer .. datas[1]
local data_len = #datas
if datas[data_len] ~= '' then
data_buffer = datas[data_len]
data_len = data_len - 1
else
data_buffer = ''
end
for i = 1, data_len do
local data = datas[i]
if #data > 0 then
options.on_received(self, data)
end
Expand All @@ -35,6 +45,9 @@ function Job:start(command, options)
end
if options.on_completed then
jobopts.on_exit = function(id, code, event)
if options.on_received and data_buffer ~= '' then
options.on_received(self, data_buffer)
end
options.on_completed(self, code)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lua/vfiler/libs/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ local function parse_git_status(rootpath, result)
local splitted = vim.list.from(vim.fn.split(rpath, ' -> '))
rpath = splitted[#splitted]
-- Removing: extra characters
rpath = rpath:gsub('^"', ''):gsub('^"', '')
rpath = rpath:gsub('^"', ''):gsub('"$', '')
return core.path.join(rootpath, rpath),
{ us = status:sub(1, 1), them = status:sub(2, 2) }
end
Expand Down

0 comments on commit 0edad19

Please sign in to comment.