0
0
mirror of https://github.com/vim/vim.git synced 2025-11-14 23:04:02 -05:00

patch 9.1.1883: Wrong display with 'smoothscroll' with -diff

Problem:  Wrong display with 'smoothscroll' when FEAT_DIFF is disabled.
Solution: Use plines_correct_topline() (zeertzjq).

closes: #18649

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2025-10-28 19:03:22 +00:00
committed by Christian Brabandt
parent 21ef3c6e59
commit e06e70f7b1
5 changed files with 11 additions and 25 deletions

View File

@@ -1919,13 +1919,8 @@ win_update(win_T *wp)
// Correct the first entry for filler lines at the top // Correct the first entry for filler lines at the top
// when it won't get updated below. // when it won't get updated below.
if (wp->w_p_diff && bot_start > 0) if (wp->w_p_diff && bot_start > 0)
{ wp->w_lines[0].wl_size = plines_correct_topline(wp,
int n = plines_win_nofill(wp, wp->w_topline, FALSE) wp->w_topline, TRUE);
+ wp->w_topfill - adjust_plines_for_skipcol(wp);
if (n > wp->w_height)
n = wp->w_height;
wp->w_lines[0].wl_size = n;
}
#endif #endif
} }
} }
@@ -2342,21 +2337,7 @@ win_update(win_T *wp)
++new_rows; ++new_rows;
else else
#endif #endif
{ new_rows += plines_correct_topline(wp, l, TRUE);
#ifdef FEAT_DIFF
if (l == wp->w_topline)
{
int n = plines_win_nofill(wp, l, FALSE)
+ wp->w_topfill;
n -= adjust_plines_for_skipcol(wp);
if (n > wp->w_height)
n = wp->w_height;
new_rows += n;
}
else
#endif
new_rows += plines_win(wp, l, TRUE);
}
++j; ++j;
if (new_rows > wp->w_height - row - 2) if (new_rows > wp->w_height - row - 2)
{ {

View File

@@ -39,7 +39,7 @@ static void botline_forw(lineoff_T *lp);
/* /*
* Get the number of screen lines skipped with "wp->w_skipcol". * Get the number of screen lines skipped with "wp->w_skipcol".
*/ */
int static int
adjust_plines_for_skipcol(win_T *wp) adjust_plines_for_skipcol(win_T *wp)
{ {
if (wp->w_skipcol == 0) if (wp->w_skipcol == 0)
@@ -58,7 +58,7 @@ adjust_plines_for_skipcol(win_T *wp)
* whether it is the first line, whether w_skipcol is non-zero and limiting to * whether it is the first line, whether w_skipcol is non-zero and limiting to
* the window height. * the window height.
*/ */
static int int
plines_correct_topline(win_T *wp, linenr_T lnum, int limit_winheight) plines_correct_topline(win_T *wp, linenr_T lnum, int limit_winheight)
{ {
int n; int n;

View File

@@ -1,5 +1,5 @@
/* move.c */ /* move.c */
int adjust_plines_for_skipcol(win_T *wp); int plines_correct_topline(win_T *wp, linenr_T lnum, int limit_winheight);
void set_valid_virtcol(win_T *wp, colnr_T vcol); void set_valid_virtcol(win_T *wp, colnr_T vcol);
int sms_marker_overlap(win_T *wp, int extra2); int sms_marker_overlap(win_T *wp, int extra2);
void update_topline_redraw(void); void update_topline_redraw(void);

View File

@@ -277,6 +277,7 @@ endfunc
func Test_smoothscroll_diff_mode() func Test_smoothscroll_diff_mode()
CheckScreendump CheckScreendump
CheckFeature diff
let lines =<< trim END let lines =<< trim END
vim9script vim9script
@@ -303,6 +304,7 @@ endfunc
func Test_smoothscroll_diff_change_line_default() func Test_smoothscroll_diff_change_line_default()
CheckScreendump CheckScreendump
CheckFeature diff
" Uses the new diffopt default with indent-heuristic and inline:char " Uses the new diffopt default with indent-heuristic and inline:char
let lines =<< trim END let lines =<< trim END
@@ -334,6 +336,7 @@ endfunc
func Test_smoothscroll_diff_change_line() func Test_smoothscroll_diff_change_line()
CheckScreendump CheckScreendump
CheckFeature diff
" Uses the old diffopt default " Uses the old diffopt default
let lines =<< trim END let lines =<< trim END

View File

@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1883,
/**/ /**/
1882, 1882,
/**/ /**/