currentLineIndex property

int get currentLineIndex

Gets the index of the current line where the cursor is located.

Implementation

int get currentLineIndex {
  var cursorPos = selection.base.offset;
  String txt = text.replaceMany(breaklineChars, breakline);
  var textpart = txt.first(cursorPos);
  var curIndex = textpart.count(breakline);
  curIndex = curIndex.clamp(0, countLines - 1);
  return curIndex;
}