feat: add auto_resize config for hover window
This commit is contained in:
@@ -58,6 +58,8 @@ return {
|
||||
spinner = 'dots',
|
||||
---@type string -- TODO :support replace with {{special word}}
|
||||
fallback_message = '翻译超时或没有找到相关的翻译',
|
||||
auto_resize = true,
|
||||
padding = 10, -- only work when auto_resize is true
|
||||
keymaps = {
|
||||
play = '_',
|
||||
pageup = '[[',
|
||||
|
@@ -95,21 +95,17 @@ end
|
||||
---@param opts
|
||||
---|{ width: integer, height: integer }
|
||||
function window:resize(opts)
|
||||
local width = opts.width
|
||||
local height = opts.height
|
||||
|
||||
|
||||
if self:height() ~= height then
|
||||
if opts.height and self:height() ~= opts.height then
|
||||
self:smooth_expand {
|
||||
field = 'height',
|
||||
to = height
|
||||
to = opts.height
|
||||
}
|
||||
end
|
||||
|
||||
if self:width() ~= width then
|
||||
if opts.width and self:width() ~= opts.width then
|
||||
self:smooth_expand {
|
||||
field = 'width',
|
||||
to = width
|
||||
to = opts.width
|
||||
}
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user