src/popupwin.c
static void
popup_show_curline(win_T *wp)
{
    if (wp->w_cursor.lnum < wp->w_topline)
	wp->w_topline = wp->w_cursor.lnum;
    else if (wp->w_cursor.lnum >= wp->w_botline
					  && (curwin->w_valid & VALID_BOTLINE))
    {
	wp->w_topline = wp->w_cursor.lnum - wp->w_height + 1;
	if (wp->w_topline < 1)
	    wp->w_topline = 1;
	else if (wp->w_topline > wp->w_buffer->b_ml.ml_line_count)
	    wp->w_topline = wp->w_buffer->b_ml.ml_line_count;
	while (wp->w_topline < wp->w_cursor.lnum
		&& wp->w_topline < wp->w_buffer->b_ml.ml_line_count
		&& plines_m_win(wp, wp->w_topline, wp->w_cursor.lnum)
								> wp->w_height)
	    ++wp->w_topline;
    }

    // Don't use "firstline" now.
    wp->w_firstline = 0;
}
/*
 * Scroll to show the line with the cursor.
 */
Scroll to show the line with the cursor.
Scroll to show the line with the cursor .
static void
popup_show_curline(win_T *wp)
{
    if (wp->w_cursor.lnum < wp->w_topline)
	wp->w_topline = wp->w_cursor.lnum;
    else if (wp->w_cursor.lnum >= wp->w_botline
					  && (curwin->w_valid & VALID_BOTLINE))
    {
	wp->w_topline = wp->w_cursor.lnum - wp->w_height + 1;
	if (wp->w_topline < 1)
	    wp->w_topline = 1;
	else if (wp->w_topline > wp->w_buffer->b_ml.ml_line_count)
	    wp->w_topline = wp->w_buffer->b_ml.ml_line_count;
	while (wp->w_topline < wp->w_cursor.lnum
		&& wp->w_topline < wp->w_buffer->b_ml.ml_line_count
		&& plines_m_win(wp, wp->w_topline, wp->w_cursor.lnum)
								> wp->w_height)
	    ++wp->w_topline;
    }
    wp->w_firstline = 0;
}
static void popup_show_curline ( win_T * wp ) { if ( wp -> w_cursor . lnum < wp -> w_topline ) wp -> w_topline = wp -> w_cursor . lnum ; else if ( wp -> w_cursor . lnum >= wp -> w_botline && ( curwin -> w_valid & VALID_BOTLINE ) ) { wp -> w_topline = wp -> w_cursor . lnum - wp -> w_height + 1 ; if ( wp -> w_topline < 1 ) wp -> w_topline = 1 ; else if ( wp -> w_topline > wp -> w_buffer -> b_ml . ml_line_count ) wp -> w_topline = wp -> w_buffer -> b_ml . ml_line_count ; while ( wp -> w_topline < wp -> w_cursor . lnum && wp -> w_topline < wp -> w_buffer -> b_ml . ml_line_count && plines_m_win ( wp , wp -> w_topline , wp -> w_cursor . lnum ) > wp -> w_height ) ++ wp -> w_topline ; } wp -> w_firstline = 0 ; }
Scroll to show the line with the cursor.
Scroll to show the line with the cursor .
// Don't use "firstline" now.