vendor/fltk-sys/cfltk/fltk/src/Fl_Text_Display.cxx
/**
 \brief Count the number of lines between two positions.

 Same as Fl_Text_Buffer::count_lines(), but takes into account wrapping if
 wrapping is turned on. If the caller knows that \p startPos is at a line
 start, it can pass \p startPosIsLineStart as True to make the call more
 efficient by avoiding the additional step of scanning back to the last newline.

 \param startPos index to first character
 \param endPos index after last character
 \param startPosIsLineStart avoid scanning back to the line start
 \return number of lines
 */
\brief Count the number of lines between two positions.
Same as Fl_Text_Buffer::count_lines(), but takes into account wrapping if
wrapping is turned on. If the caller knows that \p startPos is at a line
start, it can pass \p startPosIsLineStart as True to make the call more
efficient by avoiding the additional step of scanning back to the last newline.

\param startPos index to first character
\param endPos index after last character
\param startPosIsLineStart avoid scanning back to the line start
\return number of lines
\ brief Count the number of lines between two positions . Same as Fl_Text_Buffer :: count_lines () but takes into account wrapping if wrapping is turned on . If the caller knows that \ p startPos is at a line start it can pass \ p startPosIsLineStart as True to make the call more efficient by avoiding the additional step of scanning back to the last newline . \ param startPos index to first character \ param endPos index after last character \ param startPosIsLineStart avoid scanning back to the line start \ return number of lines
int Fl_Text_Display::count_lines(int startPos, int endPos,
                                 bool startPosIsLineStart) const {
  IS_UTF8_ALIGNED2(buffer(), startPos)
  IS_UTF8_ALIGNED2(buffer(), endPos)
  int retLines, retPos, retLineStart, retLineEnd;
#ifdef DEBUG
  printf("Fl_Text_Display::count_lines(startPos=%d, endPos=%d, startPosIsLineStart=%d\n",
         startPos, endPos, startPosIsLineStart);
#endif 
  if (!mContinuousWrap)
    return buffer()->count_lines(startPos, endPos);
  wrapped_line_counter(buffer(), startPos, endPos, INT_MAX,
                       startPosIsLineStart, 0, &retPos, &retLines, &retLineStart,
                       &retLineEnd);
#ifdef DEBUG
  printf("   # after WLC: retPos=%d, retLines=%d, retLineStart=%d, retLineEnd=%d\n",
         retPos, retLines, retLineStart, retLineEnd);
#endif 
  return retLines;
}
int Fl_Text_Display :: count_lines ( int startPos , int endPos , bool startPosIsLineStart ) const { IS_UTF8_ALIGNED2 ( buffer ( ) , startPos ) IS_UTF8_ALIGNED2 ( buffer ( ) , endPos ) int retLines , retPos , retLineStart , retLineEnd ; #ifdef DEBUG printf ( " \n " , startPos , endPos , startPosIsLineStart ) ; #endif if ( ! mContinuousWrap ) return buffer ( ) -> count_lines ( startPos , endPos ) ; wrapped_line_counter ( buffer ( ) , startPos , endPos , INT_MAX , startPosIsLineStart , 0 , & retPos , & retLines , & retLineStart , & retLineEnd ) ; #ifdef DEBUG printf ( " \n " , retPos , retLines , retLineStart , retLineEnd ) ; #endif return retLines ; }
\brief Count the number of lines between two positions.
\ brief Count the number of lines between two positions .
// DEBUG /* If we're not wrapping use simple (and more efficient) Fl_Text_Buffer::count_lines() */ // DEBUG