fix: fix window width and height and fix auto_play

This commit is contained in:
JuanZoran 2023-01-21 21:35:10 +08:00
parent 294ffe1b9f
commit c4a6ccf481
4 changed files with 8 additions and 9 deletions

View File

@ -102,7 +102,7 @@ local content = {
load = function() load = function()
assert(size > 1, 'no item need be loaded') assert(size > 1, 'no item need be loaded')
local space = math.floor((self.window.width - width) / (size - 1)) local space = math.floor((self.window.width - width) / (size - 1))
assert(space > 0, 'try to expand window width') assert(space > 0, vim.inspect(items))
local interval = (' '):rep(space) local interval = (' '):rep(space)
local line = '' local line = ''

View File

@ -7,8 +7,8 @@ M.conf = {
v = 'hover', v = 'hover',
}, },
hover = { hover = {
width = 36, width = 37,
height = 26, height = 27,
border = 'rounded', border = 'rounded',
title = { title = {
{ '', 'TransTitleRound' }, { '', 'TransTitleRound' },

View File

@ -270,9 +270,6 @@ return function(word)
-- 目前只处理了本地数据库的查询 -- 目前只处理了本地数据库的查询
m_result = require('Trans.query.offline')(word) m_result = require('Trans.query.offline')(word)
local hover = conf.hover local hover = conf.hover
if hover.auto_play then
action.play()
end
local opt = { local opt = {
relative = 'cursor', relative = 'cursor',
@ -289,6 +286,10 @@ return function(word)
m_content = m_window.contents[1] m_content = m_window.contents[1]
if m_result then if m_result then
if hover.auto_play then
action.play()
end
for _, field in ipairs(conf.order) do for _, field in ipairs(conf.order) do
process[field]() process[field]()
end end

View File

@ -1,6 +1,4 @@
const say = require('say') const say = require('say')
word = process.argv
// console.log(word) // console.log(word)
say.speak(word.slice(2)) say.speak(process.argv.slice(2))