From 2c57923f6a14b4e9729e5b3cf590c300472d2fe6 Mon Sep 17 00:00:00 2001 From: JuanZoran <1430359574@qq.com> Date: Mon, 16 Jan 2023 00:27:12 +0800 Subject: [PATCH] style: modify title style --- lua/Trans/core/handler.lua | 6 ++++-- lua/Trans/core/init.lua | 1 + lua/Trans/core/window.lua | 7 +++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lua/Trans/core/handler.lua b/lua/Trans/core/handler.lua index e95e3d9..211ddb0 100644 --- a/lua/Trans/core/handler.lua +++ b/lua/Trans/core/handler.lua @@ -57,9 +57,11 @@ end local function expl(c, text) local wrapper = c:text_wrapper() - wrapper('', 'TransTitleRound') + -- wrapper('', 'TransTitleRound') + wrapper('', 'TransTitleRound') wrapper(text, 'TransTitle') - wrapper('', 'TransTitleRound') + -- wrapper('', 'TransTitleRound') + wrapper('', 'TransTitleRound') end local indent = ' ' diff --git a/lua/Trans/core/init.lua b/lua/Trans/core/init.lua index 5f83335..3f80544 100644 --- a/lua/Trans/core/init.lua +++ b/lua/Trans/core/init.lua @@ -27,6 +27,7 @@ local function get_word(method) if method == 'n' then return vim.fn.expand('<cword>') elseif method == 'v' then + vim.api.nvim_input('<ESC>') return get_select() elseif method == 'input' then -- TODO Use Telescope with fuzzy finder diff --git a/lua/Trans/core/window.lua b/lua/Trans/core/window.lua index ae0de80..ebd2a86 100644 --- a/lua/Trans/core/window.lua +++ b/lua/Trans/core/window.lua @@ -26,7 +26,9 @@ function M.init(view) border = conf.window.border, title = { { '', 'TransTitleRound' }, + -- { '', 'TransTitleRound' }, { conf.icon.title .. ' Trans', 'TransTitle' }, + -- { '', 'TransTitleRound' }, { '', 'TransTitleRound' }, }, title_pos = 'center', @@ -122,17 +124,18 @@ M.close = function() -- Wait animation done vim.defer_fn(function () api.nvim_win_close(M.id, true) - end, 10) + end, 15) end end - vim.defer_fn(narrow, 10) + narrow() else api.nvim_win_close(M.id, true) end end end + M.show = function() M.init(M.view or 'float') M.load_opts()