Window contents shift when toggling horizontal terminals
I migrated over to this plugin from vim-terminal-help because I love switching terminals from the horizontal to floating directions on the fly. However, one difference that I noticed is that when I open/close a horizontal terminal, the contents of splits are shifted accordingly. I find this a bit distracting.
To give some more concrete information, the way that vim-terminal-help gets around this is by calling windo winsaveview and windo winrestview before and after the terminal opens/closes, respectively. That way, any shifts from opening or closing the terminal split are undone after they occur.
This seems like a simple change, so I would be happy to implement it if the shifting isn't intentional! I do wonder if the change would also make sense for the vertical layout too.
Hi @brdoney thanks for recommending this, I think some time ago in the earliest days of this plugin when it was a vimscript file in my dotfiles I did have something like this in place but there wasn't a lua equivalent so it got dropped. I'm definitely open to having this added if it does indeed work as intended. Would be good to have some sort of before and after imagery/gif.
I think it's also worth noting that splitkeep now exists and seeing whether that is something that can also help here?
I forgot about splitkeep! In particular, the topline option is pretty close to what I was looking for, but with one notable difference: it moves the cursor if it goes out of bounds. This means that one-off actions like opening a horizontal terminal, running a command, then closing the terminal have the potential to change your cursor position in all open windows, which doesn't seem ideal.
winsave/restview don't shift the cursor if it goes out of bounds, the cursor just won't be visible until you change into the split (upon which case the viewport will shift down to where it is), so there's no chance of cursor positions shifting at all in the one-off action example.
I'll give a quick implementation a shot this weekend and post some gifs of the current behaviour, the splitkeep=topline behaviour, and the behaviour with winsave/restview.
Problem description
Terminal text shifts or disappears after opening the file explorer.

@brdoney if your issue is the same as the OP's i.e. specific to horizontal windows then please have a look at the splitkeep setting as discussed. If your issue is that the file explorer buffer reduces the size of the terminal window i.e. relates to vertical windows then it joins the dozens of previous issues and comments on the issue I've had in the past and gets the same response which is that this is how neovim works.
The file explorer is not special it doesn't get any special treatment and this is how neovim behaves when a window is split vertically. I don't know a way that doesn't involve a multitude of hacks to resolve this. If you or anyone else has a solution please feel free to PR 🙏🏾 otherwise we will all just have to live with it.
To anyone reading, the "text gets chopped off after resizing" issue - I think with Neovim nightly this was fixed. See "neovim reflow", this pull request - https://github.com/neovim/neovim/pull/21124