vim: Fix ctrl-u/ctrl-d with high `vertical_scroll_margin` (#16031)
Thorsten Ball
and
Bennet
created
This makes sure that the `vertical_scroll_margin` doesn't leave the
cursor out of screen or somewhere it shouldn't go when it's higher than
the visible lines on screen.
So we cap it to `visible_line_count / 2`, similar to nvim:
https://github.com/neovim/neovim/blob/5aa1a9532cbac835ad027ebdf04311c7e8fb7007/src/nvim/window.c#L6560
Fixes #15101
Release Notes:
- Fixed `ctrl-u`/`ctrl-d` in Vim mode not working correctly when
`vertical_scroll_margin` is set to a really high value.
Co-authored-by: Bennet <bennet@zed.dev>