-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug]: There are cases where the error 'Invalid window id 1001' occurs when restoring a saved session. #430
Comments
Hey, thanks for using the plugin and reporting the issue!!!
Indeed I think most For that specific issue, is it enough to make the plugin work properly after your addition? I'd assume we should create a new window because the follow up logic might try to target a wrong window too Feel free to go ahead with the implementation! Would be great if you could add a test case to |
@shortcuts
Unfortunately, I found that the workaround I suggested earlier results in an error under certain conditions. Upon reviewing the code again, I realized it might be better to address the root cause, which seems to be that the first argument of colors.init is the invalid window id. Specifically, I moved this call inside the preceding if-then block. no-neck-pain.nvim/lua/no-neck-pain/ui.lua Line 163 in 5d91f31
if
wins[side].padding > _G.NoNeckPain.config.minSideBufferWidth
and not state.is_side_enabled_and_valid(state, side)
then
vim.cmd(wins[side].cmd)
state.set_side_id(state, vim.api.nvim_get_current_win(), side)
if _G.NoNeckPain.config.buffers.set_names then
local exist = vim.fn.bufnr("no-neck-pain-" .. side)
if exist ~= -1 then
vim.api.nvim_buf_delete(exist, { force = true })
end
vim.api.nvim_buf_set_name(0, "no-neck-pain-" .. side)
end
if _G.NoNeckPain.config.buffers[side].scratchPad.enabled then
state.set_scratchPad(state, true)
ui.init_scratchPad(side, state.get_side_id(state, side))
else
ui.init_side_options(side, state.get_side_id(state, side))
end
+
+ colors.init(state.get_side_id(state, side), side)
end
- colors.init(state.get_side_id(state, side), side) If After testing for a few minutes, no errors have occurred. I’ll continue using it for a while, and if it works without issues, I’ll create a PR. If you have any concerns or suggestions regarding this approach, please let me know 🙏 |
…h an invisible Scratch Window (shortcuts#430)
@shortcuts |
Description
In certain use cases, such as restoring a session, an error seems to occur when the state of the saved session indicates that a scratch window created by no-neck-pain was visually absent.
From the source code, I confirmed that the issue can be avoided with the following fix.
no-neck-pain.nvim/lua/no-neck-pain/colors.lua
Line 133 in 5d91f31
However, I am not sure if this is the proper solution. If this approach is appropriate and a PR is needed, please feel free to let me know.
Thank you for maintaining such an excellent plugin!
Neovim version
0.10.x
Steps to reproduce
Relevant log output
Self-service
The text was updated successfully, but these errors were encountered: