carbon-steel / detour.nvim

Use popup windows to navigate files/buffer and to contain shells/TUIs
MIT License
153 stars 4 forks source link

Error: 'width' key must be a positive Integer #16

Closed jonahfang closed 10 months ago

jonahfang commented 11 months ago

When I run 'require("detour").Detour()' I get the following error:

E5108: Error executing lua: ...vim/data/confignext/lazy/detour.nvim/lua/detour/init.lua:206: 'width' key must be a positive Integer
stack traceback:
        [C]: in function 'nvim_open_win'
        ...vim/data/confignext/lazy/detour.nvim/lua/detour/init.lua:206: in function 'popup'
        ...vim/data/confignext/lazy/detour.nvim/lua/detour/init.lua:255: in function 'Detour'
        /Users/fzx/adev/nvim/confignext/lua/plugins/detour.lua:46: in function 'show_popup'
        /Users/fzx/adev/nvim/confignext/lua/plugins/detour.lua:117: in function </Users/fzx/adev/nvim/confignext/lua/plugins/detour.lua:110>
carbon-steel commented 10 months ago

Thanks for reporting the issue! I was able to get the error to appear on my system (simply by forcing the popup to become too small). It revealed some off-by-one errors I had in my code. I am not sure if this is exactly what happened with your bug but I'll assume it is. I'm working on patching this up.

carbon-steel commented 10 months ago

With the release of v1.2.0, I've redone the arithmetic for constructing window dimensions. i think this should have fixed your issue, but please let me know if you find otherwise. Closing this issue for now. Feel free to open it again.