selectedText property

String get selectedText

Implementation

String get selectedText {
  if (!hasSelection) return '';
  final (start, end) = _range;
  return [
    for (var i = start.$1; i <= end.$1; i++)
      String.fromCharCodes(
        _sources[i].runes
            .skip(i == start.$1 ? start.$2 : 0)
            .take(
              (i == end.$1 ? end.$2 : _sources[i].runes.length) -
                  (i == start.$1 ? start.$2 : 0),
            ),
      ),
  ].join('\n');
}