src/popupwin.c
void
popup_set_wantpos_cursor(win_T *wp, int width, dict_T *d)
{
    poppos_T ppt = POPPOS_NONE;

    if (d != NULL)
	ppt = get_pos_entry(d, FALSE);

    setcursor_mayforce(TRUE);
    if (ppt == POPPOS_TOPRIGHT || ppt == POPPOS_TOPLEFT)
    {
	wp->w_wantline = curwin->w_winrow + curwin->w_wrow + 2;
    }
    else
    {
	wp->w_wantline = curwin->w_winrow + curwin->w_wrow;
	if (wp->w_wantline == 0)  // cursor in first line
	{
	    wp->w_wantline = 2;
	    wp->w_popup_pos = ppt == POPPOS_BOTRIGHT
					    ? POPPOS_TOPRIGHT : POPPOS_TOPLEFT;
	}
    }

    wp->w_wantcol = curwin->w_wincol + curwin->w_wcol + 1;
    if (wp->w_wantcol > Columns - width)
    {
	wp->w_wantcol = Columns - width;
	if (wp->w_wantcol < 1)
	    wp->w_wantcol = 1;
    }

    popup_adjust_position(wp);
}
/*
 * Set w_wantline and w_wantcol for the cursor position in the current window.
 * Keep at least "width" columns from the right of the screen.
 */
Set w_wantline and w_wantcol for the cursor position in the current window.
Keep at least "width" columns from the right of the screen.
Set w_wantline and w_wantcol for the cursor position in the current window . Keep at least " width " columns from the right of the screen .
void
popup_set_wantpos_cursor(win_T *wp, int width, dict_T *d)
{
    poppos_T ppt = POPPOS_NONE;
    if (d != NULL)
	ppt = get_pos_entry(d, FALSE);
    setcursor_mayforce(TRUE);
    if (ppt == POPPOS_TOPRIGHT || ppt == POPPOS_TOPLEFT)
    {
	wp->w_wantline = curwin->w_winrow + curwin->w_wrow + 2;
    }
    else
    {
	wp->w_wantline = curwin->w_winrow + curwin->w_wrow;
	if (wp->w_wantline == 0)  
	{
	    wp->w_wantline = 2;
	    wp->w_popup_pos = ppt == POPPOS_BOTRIGHT
					    ? POPPOS_TOPRIGHT : POPPOS_TOPLEFT;
	}
    }
    wp->w_wantcol = curwin->w_wincol + curwin->w_wcol + 1;
    if (wp->w_wantcol > Columns - width)
    {
	wp->w_wantcol = Columns - width;
	if (wp->w_wantcol < 1)
	    wp->w_wantcol = 1;
    }
    popup_adjust_position(wp);
}
void popup_set_wantpos_cursor ( win_T * wp , int width , dict_T * d ) { poppos_T ppt = POPPOS_NONE ; if ( d != NULL ) ppt = get_pos_entry ( d , FALSE ) ; setcursor_mayforce ( TRUE ) ; if ( ppt == POPPOS_TOPRIGHT || ppt == POPPOS_TOPLEFT ) { wp -> w_wantline = curwin -> w_winrow + curwin -> w_wrow + 2 ; } else { wp -> w_wantline = curwin -> w_winrow + curwin -> w_wrow ; if ( wp -> w_wantline == 0 ) { wp -> w_wantline = 2 ; wp -> w_popup_pos = ppt == POPPOS_BOTRIGHT ? POPPOS_TOPRIGHT : POPPOS_TOPLEFT ; } } wp -> w_wantcol = curwin -> w_wincol + curwin -> w_wcol + 1 ; if ( wp -> w_wantcol > Columns - width ) { wp -> w_wantcol = Columns - width ; if ( wp -> w_wantcol < 1 ) wp -> w_wantcol = 1 ; } popup_adjust_position ( wp ) ; }
Set w_wantline and w_wantcol for the cursor position in the current window.
Set w_wantline and w_wantcol for the cursor position in the current window .
// cursor in first line