feat: git log

This commit is contained in:
Folke Lemaitre 2022-11-22 21:12:50 +01:00
parent 54d5ff18f5
commit 3218c2d9ec
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
7 changed files with 83 additions and 6 deletions

View file

@ -16,7 +16,7 @@ function Text.new()
end
---@param str string
---@param hl string|table
---@param hl? string|table
function Text:append(str, hl)
if #self._lines == 0 then
self:nl()
@ -84,4 +84,19 @@ function Text:trim()
end
end
function Text:row()
return #self._lines == 0 and 1 or #self._lines
end
function Text:col()
if #self._lines == 0 then
return 0
end
local width = 0
for _, segment in ipairs(self._lines[#self._lines]) do
width = width + vim.fn.strlen(segment.str)
end
return width
end
return Text