fix(scrollbind): properly take filler/virtual lines into account

Problem:

`'scrollbind'` does not work properly if the window being scrolled
automatically contains any filler/virtual lines (except for diff filler
lines).

This is because when the scrollbind check is done, the logic only
considers changes to topline which are represented as line numbers.

Solution:

Write the logic for determine the scroll amount to take into account
filler/virtual lines.

Fixes #29751
This commit is contained in:
Lewis Russell
2024-07-17 12:23:15 +01:00
committed by Lewis Russell
parent c9b129a02a
commit 573a71469d
11 changed files with 538 additions and 46 deletions

View File

@@ -88,6 +88,7 @@
#include "nvim/os/os.h"
#include "nvim/os/os_defs.h"
#include "nvim/path.h"
#include "nvim/plines.h"
#include "nvim/popupmenu.h"
#include "nvim/pos_defs.h"
#include "nvim/regexp.h"
@@ -2474,7 +2475,7 @@ static const char *did_set_scrollbind(optset_T *args)
return NULL;
}
do_check_scrollbind(false);
win->w_scbind_pos = win->w_topline;
win->w_scbind_pos = get_vtopline(win);
return NULL;
}