Skip to content

Commit e06e70f

Browse files
zeertzjqchrisbra
authored andcommitted
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 <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 21ef3c6 commit e06e70f

5 files changed

Lines changed: 11 additions & 25 deletions

File tree

src/drawscreen.c

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,13 +1919,8 @@ win_update(win_T *wp)
19191919
// Correct the first entry for filler lines at the top
19201920
// when it won't get updated below.
19211921
if (wp->w_p_diff && bot_start > 0)
1922-
{
1923-
int n = plines_win_nofill(wp, wp->w_topline, FALSE)
1924-
+ wp->w_topfill - adjust_plines_for_skipcol(wp);
1925-
if (n > wp->w_height)
1926-
n = wp->w_height;
1927-
wp->w_lines[0].wl_size = n;
1928-
}
1922+
wp->w_lines[0].wl_size = plines_correct_topline(wp,
1923+
wp->w_topline, TRUE);
19291924
#endif
19301925
}
19311926
}
@@ -2342,21 +2337,7 @@ win_update(win_T *wp)
23422337
++new_rows;
23432338
else
23442339
#endif
2345-
{
2346-
#ifdef FEAT_DIFF
2347-
if (l == wp->w_topline)
2348-
{
2349-
int n = plines_win_nofill(wp, l, FALSE)
2350-
+ wp->w_topfill;
2351-
n -= adjust_plines_for_skipcol(wp);
2352-
if (n > wp->w_height)
2353-
n = wp->w_height;
2354-
new_rows += n;
2355-
}
2356-
else
2357-
#endif
2358-
new_rows += plines_win(wp, l, TRUE);
2359-
}
2340+
new_rows += plines_correct_topline(wp, l, TRUE);
23602341
++j;
23612342
if (new_rows > wp->w_height - row - 2)
23622343
{

src/move.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static void botline_forw(lineoff_T *lp);
3939
/*
4040
* Get the number of screen lines skipped with "wp->w_skipcol".
4141
*/
42-
int
42+
static int
4343
adjust_plines_for_skipcol(win_T *wp)
4444
{
4545
if (wp->w_skipcol == 0)
@@ -58,7 +58,7 @@ adjust_plines_for_skipcol(win_T *wp)
5858
* whether it is the first line, whether w_skipcol is non-zero and limiting to
5959
* the window height.
6060
*/
61-
static int
61+
int
6262
plines_correct_topline(win_T *wp, linenr_T lnum, int limit_winheight)
6363
{
6464
int n;

src/proto/move.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* move.c */
2-
int adjust_plines_for_skipcol(win_T *wp);
2+
int plines_correct_topline(win_T *wp, linenr_T lnum, int limit_winheight);
33
void set_valid_virtcol(win_T *wp, colnr_T vcol);
44
int sms_marker_overlap(win_T *wp, int extra2);
55
void update_topline_redraw(void);

src/testdir/test_scroll_opt.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ endfunc
277277

278278
func Test_smoothscroll_diff_mode()
279279
CheckScreendump
280+
CheckFeature diff
280281

281282
let lines =<< trim END
282283
vim9script
@@ -303,6 +304,7 @@ endfunc
303304

304305
func Test_smoothscroll_diff_change_line_default()
305306
CheckScreendump
307+
CheckFeature diff
306308

307309
" Uses the new diffopt default with indent-heuristic and inline:char
308310
let lines =<< trim END
@@ -334,6 +336,7 @@ endfunc
334336

335337
func Test_smoothscroll_diff_change_line()
336338
CheckScreendump
339+
CheckFeature diff
337340

338341
" Uses the old diffopt default
339342
let lines =<< trim END

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ static char *(features[]) =
729729

730730
static int included_patches[] =
731731
{ /* Add new patch number below this line */
732+
/**/
733+
1883,
732734
/**/
733735
1882,
734736
/**/

0 commit comments

Comments
 (0)