resession.nvim
resession.nvim copied to clipboard
fix: restore window cursor pos after setting size
This fixes an issue I was running into where the cursor position of open buffers would not get restored properly.
The easiest way to reproduce is to open a file where the length of the file is at least a couple times longer than the window height. Then scroll down all the way to the bottom, create/save a session, and exit Neovim. If you then reopen Neovim and load the session, you should see that the cursor is in the wrong place (for me, it always is at line 45).
Edit: this is happening because I've set splitkeep=screen
(because I'm using https://github.com/folke/edgy.nvim) - setting it back to the default splitkeep=cursor
also fixes the issue. A more complicated fix would be to temporarily set splitkeep=cursor
while loading the window layout, but just reordering the operations achieves the same thing and is simpler.