Skip to content

Commit dd4caad

Browse files
committed
fix cursor when line only contains an image
1 parent 2c9bbcf commit dd4caad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/src/widgets/proxy.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ class RenderEmbedProxy extends RenderProxyBox implements RenderContentProxyBox {
103103

104104
@override
105105
Offset getOffsetForCaret(TextPosition position, Rect? caretPrototype) {
106-
assert(position.offset == 1 || position.offset == 0);
107-
return position.offset == 0
106+
assert(
107+
position.offset == 1 || position.offset == 0 || position.offset == -1);
108+
return position.offset <= 0
108109
? Offset.zero
109110
: Offset(
110111
size.width - (caretPrototype == null ? 0 : caretPrototype.width),

0 commit comments

Comments
 (0)