removeChar method

void removeChar()

Remove the char just before the cursor or the selection

Implementation

void removeChar() {
  if (selection.start < 1) {
    return;
  }

  final sel = selection;
  text = text.replaceRange(selection.start - 1, selection.start, '');

  selection = sel.copyWith(
    baseOffset: sel.start - 1,
    extentOffset: sel.start - 1,
  );
}