Fix: Up arrow with large fonts, assert at start of text for indent

pull/2025/head
AtlasAutocode 9 months ago
parent 320c17838a
commit c919703b8b
  1. 2
      lib/src/widgets/quill/text_block.dart
  2. 8
      lib/src/widgets/quill/text_line.dart

@ -691,7 +691,7 @@ class RenderEditableTextBlock extends RenderEditableContainerBox
@override @override
TextPosition globalToLocalPosition(TextPosition position) { 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'); 'The provided text position is not in the current node');
return TextPosition( return TextPosition(
offset: position.offset - container.documentOffset, offset: position.offset - container.documentOffset,

@ -921,7 +921,13 @@ class RenderEditableTextLine extends RenderEditableBox {
@override @override
TextPosition? getPositionAbove(TextPosition position) { 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 @override

Loading…
Cancel
Save