mirror of
https://github.com/NotAShelf/specs.nvim.git
synced 2025-02-22 03:18:02 +00:00
Cleanup + remove win_id args
This commit is contained in:
parent
55ff1ece72
commit
5a6c375b80
1 changed files with 19 additions and 25 deletions
|
@ -34,8 +34,8 @@ function M.show_specs()
|
||||||
|
|
||||||
vim.loop.timer_start(timer, opts.popup.delay_ms, opts.popup.inc_ms, vim.schedule_wrap(function()
|
vim.loop.timer_start(timer, opts.popup.delay_ms, opts.popup.inc_ms, vim.schedule_wrap(function()
|
||||||
if vim.api.nvim_win_is_valid(win_id) then
|
if vim.api.nvim_win_is_valid(win_id) then
|
||||||
local bl = opts.popup.fader(win_id, opts.popup.blend, cnt)
|
local bl = opts.popup.fader(opts.popup.blend, cnt)
|
||||||
local dm = opts.popup.resizer(win_id, {opts.popup.width, cursor_col}, cnt)
|
local dm = opts.popup.resizer(opts.popup.width, cursor_col, cnt)
|
||||||
|
|
||||||
if bl ~= nil then
|
if bl ~= nil then
|
||||||
vim.api.nvim_win_set_option(win_id, "winblend", bl)
|
vim.api.nvim_win_set_option(win_id, "winblend", bl)
|
||||||
|
@ -56,8 +56,8 @@ end
|
||||||
|
|
||||||
--[[ ▁▁▂▂▃▃▄▄▅▅▆▆▇▇██ ]]--
|
--[[ ▁▁▂▂▃▃▄▄▅▅▆▆▇▇██ ]]--
|
||||||
|
|
||||||
function M.linear_fader(win_id, bl, cnt)
|
function M.linear_fader(blend, cnt)
|
||||||
if bl + cnt <= 100 then
|
if blend + cnt <= 100 then
|
||||||
return cnt
|
return cnt
|
||||||
else return nil end
|
else return nil end
|
||||||
end
|
end
|
||||||
|
@ -65,59 +65,53 @@ end
|
||||||
|
|
||||||
--[[ ▁▁▁▁▂▂▂▃▃▃▄▄▅▆▇ ]]--
|
--[[ ▁▁▁▁▂▂▂▃▃▃▄▄▅▆▇ ]]--
|
||||||
|
|
||||||
function M.exp_fader(win_id, bl, cnt)
|
function M.exp_fader(blend, cnt)
|
||||||
if bl + math.floor(math.exp(cnt/10)) <= 100 then
|
if blend + math.floor(math.exp(cnt/10)) <= 100 then
|
||||||
return bl + math.floor(math.exp(cnt/10))
|
return blend + math.floor(math.exp(cnt/10))
|
||||||
else return nil end
|
else return nil end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[ ▁▂▃▄▅▆▇█▇▆▅▄▃▂▁ ]]--
|
--[[ ▁▂▃▄▅▆▇█▇▆▅▄▃▂▁ ]]--
|
||||||
|
|
||||||
function M.pulse_fader(win_id, bl, cnt)
|
function M.pulse_fader(blend, cnt)
|
||||||
if cnt < (100-bl)/2 then
|
if cnt < (100-blend)/2 then
|
||||||
return cnt
|
return cnt
|
||||||
elseif cnt < 100-bl then
|
elseif cnt < 100-blend then
|
||||||
return 100-cnt
|
return 100-cnt
|
||||||
else return nil end
|
else return nil end
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[ ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ]]--
|
--[[ ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ]]--
|
||||||
|
|
||||||
function M.empty_fader(win_id, bl, cnt)
|
function M.empty_fader(blend, cnt)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[ ░░▒▒▓█████▓▒▒░░ ]]--
|
--[[ ░░▒▒▓█████▓▒▒░░ ]]--
|
||||||
|
|
||||||
function M.shrink_resizer(win_id, dm, cnt)
|
function M.shrink_resizer(width, ccol, cnt)
|
||||||
width = dm[1]-cnt
|
if width-cnt > 0 then
|
||||||
col = dm[2] - width/2 +1
|
return {width-cnt, ccol-(width-cnt)/2 + 1}
|
||||||
if width > 0 then
|
|
||||||
return {width, col}
|
|
||||||
else return nil end
|
else return nil end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[ ████▓▓▓▒▒▒▒░░░░ ]]--
|
--[[ ████▓▓▓▒▒▒▒░░░░ ]]--
|
||||||
|
|
||||||
function M.slide_resizer(win_id, dm, cnt)
|
function M.slide_resizer(width, ccol, cnt)
|
||||||
width = dm[1]-cnt
|
if width-cnt > 0 then
|
||||||
col = dm[2]
|
return {width-cnt, ccol}
|
||||||
if width > 0 then
|
|
||||||
return {width, col}
|
|
||||||
else return nil end
|
else return nil end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[ ███████████████ ]]--
|
--[[ ███████████████ ]]--
|
||||||
|
|
||||||
function M.empty_resizer(win_id, dm, cnt)
|
function M.empty_resizer(width, ccol, cnt)
|
||||||
if cnt < 100 then
|
if cnt < 100 then
|
||||||
width = dm[1]
|
return {width, ccol - width/2}
|
||||||
col = dm[2] - width/2
|
|
||||||
return {width, col}
|
|
||||||
else return nil end
|
else return nil end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue