diff --git a/lib/src/widgets/quill/text_block.dart b/lib/src/widgets/quill/text_block.dart index c0b6b187..e3de668c 100644 --- a/lib/src/widgets/quill/text_block.dart +++ b/lib/src/widgets/quill/text_block.dart @@ -691,7 +691,7 @@ class RenderEditableTextBlock extends RenderEditableContainerBox @override TextPosition globalToLocalPosition(TextPosition position) { - assert(container.containsOffset(position.offset), + assert(container.containsOffset(position.offset) || container.length == 0, 'The provided text position is not in the current node'); return TextPosition( offset: position.offset - container.documentOffset, diff --git a/lib/src/widgets/quill/text_line.dart b/lib/src/widgets/quill/text_line.dart index c3dbb146..31db5211 100644 --- a/lib/src/widgets/quill/text_line.dart +++ b/lib/src/widgets/quill/text_line.dart @@ -921,7 +921,13 @@ class RenderEditableTextLine extends RenderEditableBox { @override TextPosition? getPositionAbove(TextPosition position) { - return _getPosition(position, -0.5); + /// Move up by fraction of the default font height, larger font sizes need larger offset + for ( var offset = -0.5; ; offset -= 0.25 ) { + final pos = _getPosition(position, offset); + if ( pos != position || offset <= -2.0 ) { + return pos; + } + } } @override