Skip to content

Commit

Permalink
fix: dont call wincmd from cmd line window
Browse files Browse the repository at this point in the history
  • Loading branch information
mp2720 committed Oct 19, 2023
1 parent 8355be4 commit 4fcc43f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lua/edgy/edgebar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,19 @@ function M:layout()
-- move first window to the edgebar position
-- and make floating windows normal windows
if not last or vim.api.nvim_win_get_config(w.win).relative ~= "" then
vim.api.nvim_win_call(w.win, function()
vim.cmd("wincmd " .. wincmds[self.pos])
-- fix for https://github.com/folke/edgy.nvim/issues/58
-- the problem is that wincmd can be called with the command line window opened, which causes
-- an E11 error
-- this may not be the best solution, but it works for me
local ok = vim.api.nvim_win_call(w.win, function()
return pcall(vim.cmd, "wincmd " .. wincmds[self.pos])
end)
if not ok then
-- to prevent this function from being called multiple times when the command line window
-- is still opened
self.dirty = false
return
end
end
-- move other windows to the end of the edgebar
if last then
Expand Down

0 comments on commit 4fcc43f

Please sign in to comment.