src/nvim/screen.c
/*
 * Return the width of the 'number' and 'relativenumber' column.
 * Caller may need to check if 'number' or 'relativenumber' is set.
 * Otherwise it depends on 'numberwidth' and the line count.
 */
Return the width of the 'number' and 'relativenumber' column.
Caller may need to check if 'number' or 'relativenumber' is set.
Otherwise it depends on 'numberwidth' and the line count.
Return the width of the ' number ' and ' relativenumber ' column . Caller may need to check if ' number ' or ' relativenumber ' is set . Otherwise it depends on ' numberwidth ' and the line count .
int number_width(win_T *wp)
{
  int n;
  linenr_T lnum;
  if (wp->w_p_rnu && !wp->w_p_nu) {
    lnum = wp->w_height_inner;
  } else {
    lnum = wp->w_buffer->b_ml.ml_line_count;
  }
  if (lnum == wp->w_nrwidth_line_count)
    return wp->w_nrwidth_width;
  wp->w_nrwidth_line_count = lnum;
  n = 0;
  do {
    lnum /= 10;
    ++n;
  } while (lnum > 0);
  if (n < wp->w_p_nuw - 1)
    n = wp->w_p_nuw - 1;
  wp->w_nrwidth_width = n;
  return n;
}
int number_width ( win_T * wp ) { int n ; linenr_T lnum ; if ( wp -> w_p_rnu && ! wp -> w_p_nu ) { lnum = wp -> w_height_inner ; } else { lnum = wp -> w_buffer -> b_ml . ml_line_count ; } if ( lnum == wp -> w_nrwidth_line_count ) return wp -> w_nrwidth_width ; wp -> w_nrwidth_line_count = lnum ; n = 0 ; do { lnum /= 10 ; ++ n ; } while ( lnum > 0 ) ; if ( n < wp -> w_p_nuw - 1 ) n = wp -> w_p_nuw - 1 ; wp -> w_nrwidth_width = n ; return n ; }
Return the width of the 'number' and 'relativenumber' column.
Return the width of the ' number ' and ' relativenumber ' column .
// cursor line shows "0" // cursor line shows absolute line number /* 'numberwidth' gives the minimal width plus one */