fix: fix window is not valid

This commit is contained in:
JuanZoran
2023-02-18 13:13:32 +08:00
parent 0dca4c2007
commit c6c5bf4f7c
4 changed files with 30 additions and 3 deletions

View File

@@ -82,6 +82,7 @@ local function process()
end
return function(word)
buffer:init()
-- TODO :online query
-- local float = conf.float
vim.notify([[

View File

@@ -1,9 +1,10 @@
local api = vim.api
local conf = require('Trans').conf
local hover = conf.hover
local buffer = require('Trans.buffer')()
local error_msg = conf.icon.notfound .. ' 没有找到相关的翻译'
local buffer = require('Trans.buffer')()
local node = require('Trans.node')
local it, t, f = node.item, node.text, node.format
@@ -375,6 +376,7 @@ return function(word)
width = width,
height = math.min(buffer:height(width), hover.height)
}
run(function()
win:set('wrap', true)
handle_keymap(win, word)