chore: sync

This commit is contained in:
JuanZoran
2023-04-01 09:54:35 +08:00
parent 987e1a3341
commit 9357574b5c
4 changed files with 52 additions and 29 deletions

View File

@ -91,11 +91,7 @@ end
---@return integer
function buffer:line_count()
local line_count = api.nvim_buf_line_count(self.bufnr)
if line_count == 1 and self[1] == '' then
return 0
end
return line_count
return line_count == 1 and self[1] == '' and 0 or line_count
end
---Set line content
@ -151,11 +147,11 @@ buffer.__index = function(self, key)
end
end
buffer.__newindex = function(self, key, nodes)
buffer.__newindex = function(self, key, values)
if type(key) == 'number' then
self:setline(nodes, key)
self:setline(values, key)
else
rawset(self, key, nodes)
rawset(self, key, values)
end
end

View File

@ -164,8 +164,6 @@ window.__index = window
---|{style: string, border: string, focusable: boolean, noautocmd?: boolean, relative: 'mouse'|'cursor'|'editor'|'win', width: integer, height: integer, col: integer, row: integer, zindex?: integer, title?: table | string}
---@class TransWindow
---@field buffer TransBuffer attached buffer object
---@field win_opts table window config [**When open**]