updateSelection method
Update the active selection range
Implementation
void updateSelection(TextSelection newSelection) {
final base = newSelection.baseOffset.clamp(0, _text.length);
final extent = newSelection.extentOffset.clamp(0, _text.length);
_selection = newSelection.copyWith(baseOffset: base, extentOffset: extent);
notifyListeners();
}