diff --git a/lib/src/widgets/controller.dart b/lib/src/widgets/controller.dart index 64c559f2..22763ca0 100644 --- a/lib/src/widgets/controller.dart +++ b/lib/src/widgets/controller.dart @@ -79,13 +79,13 @@ class QuillController extends ChangeNotifier { } void _handleHistoryChange(int? len) { - if (len != 0) { + if (len! > 0) { // if (this.selection.extentOffset >= document.length) { // // cursor exceeds the length of document, position it in the end // updateSelection( // TextSelection.collapsed(offset: document.length), ChangeSource.LOCAL); updateSelection( - TextSelection.collapsed(offset: selection.baseOffset + len!), + TextSelection.collapsed(offset: selection.baseOffset + len), ChangeSource.LOCAL); } else { // no need to move cursor