File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -745,16 +745,8 @@ endfunc
745745
746746func Test_split_noscroll ()
747747 let so_save = &so
748- new
749- only
750-
751- " Make sure windows can hold all content after split.
752- for i in range (1 , 20 )
753- wincmd +
754- redraw !
755- endfor
756-
757- call setline (1 , range (1 , 8 ))
748+ enew
749+ call setline (1 , range (1 , 8 ))
758750 normal 100 %
759751 split
760752
@@ -769,12 +761,20 @@ func Test_split_noscroll()
769761 call assert_equal (1 , info1.topline)
770762 call assert_equal (1 , info2.topline)
771763
772- " Restore original state.
773- for i in range (1 , 20 )
774- wincmd -
775- redraw !
776- endfor
764+ " window that fits all lines by itself, but not when split: closing other
765+ " window should restore fraction.
777766 only !
767+ call setline (1 , range (1 , &lines - 10 ))
768+ exe &lines / 4
769+ let winid1 = win_getid ()
770+ let info1 = getwininfo (winid1)[0 ]
771+ call assert_equal (1 , info1.topline)
772+ new
773+ redraw
774+ close
775+ let info1 = getwininfo (winid1)[0 ]
776+ call assert_equal (1 , info1.topline)
777+
778778 bwipe!
779779 let &so = so_save
780780endfunc
Original file line number Diff line number Diff line change @@ -767,6 +767,8 @@ static char *(features[]) =
767767
768768static int included_patches [] =
769769{ /* Add new patch number below this line */
770+ /**/
771+ 1347 ,
770772/**/
771773 1346 ,
772774/**/
Original file line number Diff line number Diff line change @@ -5830,10 +5830,11 @@ scroll_to_fraction(win_T *wp, int prev_height)
58305830 // Don't change w_topline in any of these cases:
58315831 // - window height is 0
58325832 // - 'scrollbind' is set and this isn't the current window
5833- // - window height is sufficient to display the whole buffer
5833+ // - window height is sufficient to display the whole buffer and first line
5834+ // is visible.
58345835 if (height > 0
58355836 && (!wp -> w_p_scb || wp == curwin )
5836- && (height < wp -> w_buffer -> b_ml .ml_line_count ))
5837+ && (height < wp -> w_buffer -> b_ml .ml_line_count || wp -> w_topline > 1 ))
58375838 {
58385839 /*
58395840 * Find a value for w_topline that shows the cursor at the same
You can’t perform that action at this time.
0 commit comments