mod/maxgui.mod/fltkmaxgui.mod/src/Fl_Text_Display.cxx
int Fl_Text_Display::position_to_linecol( int pos, int* lineNum, int* column ) const {
  IS_UTF8_ALIGNED2(buffer(), pos)
  
  int retVal;
  
  /* In continuous wrap mode, the absolute (non-wrapped) line count is
   maintained separately, as needed.  Only return it if we're actually
   keeping track of it and pos is in the displayed text */
  if (mContinuousWrap) {
    if (!maintaining_absolute_top_line_number() || pos < mFirstChar || pos > mLastChar)
      return 0;
    *lineNum = mAbsTopLineNum + buffer()->count_lines(mFirstChar, pos);
    *column = buffer()->count_displayed_characters(buffer()->line_start(pos), pos);
    return 1;
  }
  
  retVal = position_to_line( pos, lineNum );
  if ( retVal ) {
    *column = mBuffer->count_displayed_characters( mLineStarts[ *lineNum ], pos );
    *lineNum += mTopLineNum;
  }
  return retVal;
}
/**
 \brief Find the line and column number of position "pos".  
 
 This only works for displayed lines.  If the line is not displayed, the 
 function returns 0 (without the mLineStarts array it could turn in to very long
 calculation involving scanning large amounts of text in the buffer).
 If continuous wrap mode is on, returns the absolute line number (as opposed
 to the wrapped line number which is used for scrolling).
 
 \param pos character index
 \param[out] lineNum absoluet (unwrapped) line number
 \param[out] column character offset to the beginning of the line *
 \return 0 if /p pos is off screen, line number otherwise
 \todo a column number makes little sense in the UTF-8/variable font width 
    environment. We will have to further define what exactly we want to return. 
    Please check teh functions that call this particular function.
 */
\brief Find the line and column number of position "pos".
This only works for displayed lines.  If the line is not displayed, the
function returns 0 (without the mLineStarts array it could turn in to very long
calculation involving scanning large amounts of text in the buffer).
If continuous wrap mode is on, returns the absolute line number (as opposed
to the wrapped line number which is used for scrolling).


\ brief Find the line and column number of position " pos " . This only works for displayed lines . If the line is not displayed the function returns 0 ( without the mLineStarts array it could turn in to very long calculation involving scanning large amounts of text in the buffer ) . If continuous wrap mode is on returns the absolute line number ( as opposed to the wrapped line number which is used for scrolling ) .
int Fl_Text_Display::position_to_linecol( int pos, int* lineNum, int* column ) const {
  IS_UTF8_ALIGNED2(buffer(), pos)
  int retVal;
  if (mContinuousWrap) {
    if (!maintaining_absolute_top_line_number() || pos < mFirstChar || pos > mLastChar)
      return 0;
    *lineNum = mAbsTopLineNum + buffer()->count_lines(mFirstChar, pos);
    *column = buffer()->count_displayed_characters(buffer()->line_start(pos), pos);
    return 1;
  }
  retVal = position_to_line( pos, lineNum );
  if ( retVal ) {
    *column = mBuffer->count_displayed_characters( mLineStarts[ *lineNum ], pos );
    *lineNum += mTopLineNum;
  }
  return retVal;
}
int Fl_Text_Display :: position_to_linecol ( int pos , int * lineNum , int * column ) const { IS_UTF8_ALIGNED2 ( buffer ( ) , pos ) int retVal ; if ( mContinuousWrap ) { if ( ! maintaining_absolute_top_line_number ( ) || pos < mFirstChar || pos > mLastChar ) return 0 ; * lineNum = mAbsTopLineNum + buffer ( ) -> count_lines ( mFirstChar , pos ) ; * column = buffer ( ) -> count_displayed_characters ( buffer ( ) -> line_start ( pos ) , pos ) ; return 1 ; } retVal = position_to_line ( pos , lineNum ) ; if ( retVal ) { * column = mBuffer -> count_displayed_characters ( mLineStarts [ * lineNum ] , pos ) ; * lineNum += mTopLineNum ; } return retVal ; }
\brief Find the line and column number of position "pos".
\ brief Find the line and column number of position " pos " .
/* In continuous wrap mode, the absolute (non-wrapped) line count is
   maintained separately, as needed.  Only return it if we're actually
   keeping track of it and pos is in the displayed text */