Closed bellini666 closed 5 months ago
I can confirm this fixed the issue for me. Thanks @bellini666 !
@bellini666 Not fixing for me. The solution you are providing is totally ignoring my notify
configuration.
Here's what is working for me (Idk if I'm breaking something or not, I'm not really familiar with Lua and Notify) :
function M.slot_after_previous(win, open_windows, direction)
local key = slot_key(direction)
local cmp = is_increasing(direction) and less or greater
local exists, cur_win_conf = util.get_win_config(win)
if not exists then
return 0
end
local cur_slot = cur_win_conf[key]
local win_confs = {}
for _, w in ipairs(open_windows) do
local success, conf = pcall(vim.api.nvim_win_get_config, w)
if success then
win_confs[w] = conf
end
end
local preceding_wins = vim.tbl_filter(function(open_win)
return win_confs[open_win] and cmp(win_confs[open_win][key], cur_slot)
end, open_windows)
if #preceding_wins == 0 then
local start = M.get_slot_range(direction)
if is_increasing(direction) then
return start
end
return move_slot(
direction,
start,
cur_win_conf[space_key(direction)] + border_padding(direction, cur_win_conf)
)
end
table.sort(preceding_wins, function(a, b)
return cmp(win_confs[a][key], win_confs[b][key])
end)
local last_win = preceding_wins[#preceding_wins]
local last_win_conf = win_confs[last_win]
if is_increasing(direction) then
return move_slot(
direction,
last_win_conf[key],
last_win_conf[space_key(direction)] + border_padding(direction, last_win_conf)
)
else
return move_slot(
direction,
last_win_conf[key],
cur_win_conf[space_key(direction)] + border_padding(direction, cur_win_conf)
)
end
end
@ls-devs actually you are correct. this doesn't actually fix anything, it is just returning false
for exists...
Going to close this. You should probably open a PR with your solution
nvim_get_win_config
will return tables forrow
/col
keys and trying to access them withfalse
/true
will throw an error.utils already has a custom
get_win_config
that returns the same, but handlesrow
/col
and converts them to the expected type.Been experiencing that a lot lately. I'm running neovim nightly btw
Fix #252