src/js/codemirror/fixOrderedListNumber.js
function findFirstListItem(lineNumber, cm) {
  let nextLineNumber = lineNumber;
  let lineText = cm.getLine(lineNumber);

  while (listRE.test(lineText)) {
    nextLineNumber -= 1;
    lineText = cm.getLine(nextLineNumber);
  }

  if (lineNumber === nextLineNumber) {
    nextLineNumber = -1;
  } else {
    nextLineNumber += 1;
  }

  return nextLineNumber;
}
function findFirstListItem(lineNumber, cm) {
  let nextLineNumber = lineNumber;
  let lineText = cm.getLine(lineNumber);

  while (listRE.test(lineText)) {
    nextLineNumber -= 1;
    lineText = cm.getLine(nextLineNumber);
  }

  if (lineNumber === nextLineNumber) {
    nextLineNumber = -1;
  } else {
    nextLineNumber += 1;
  }

  return nextLineNumber;
}
function findFirstListItem ( lineNumber , cm ) { let nextLineNumber = lineNumber ; let lineText = cm . getLine ( lineNumber ) ; while ( listRE . test ( lineText ) ) { nextLineNumber -= 1 ; lineText = cm . getLine ( nextLineNumber ) ; } if ( lineNumber === nextLineNumber ) { nextLineNumber = - 1 ; } else { nextLineNumber += 1 ; } return nextLineNumber ; }
find line number of list item which contains given lineNumber
@param {number} lineNumber - line number of list item
@param {CodeMirror} cm - CodeMirror instance
@returns {number} - line number of first list item
@ignore
find line number of list item which contains given lineNumber