From dd4caad379406c8c5a2ed2fb5909ba8bf2c30b59 Mon Sep 17 00:00:00 2001 From: li3317 Date: Thu, 19 Aug 2021 21:27:39 -0400 Subject: [PATCH] fix cursor when line only contains an image --- lib/src/widgets/proxy.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/widgets/proxy.dart b/lib/src/widgets/proxy.dart index 85a2a613..a1cb8c6a 100644 --- a/lib/src/widgets/proxy.dart +++ b/lib/src/widgets/proxy.dart @@ -103,8 +103,9 @@ class RenderEmbedProxy extends RenderProxyBox implements RenderContentProxyBox { @override Offset getOffsetForCaret(TextPosition position, Rect? caretPrototype) { - assert(position.offset == 1 || position.offset == 0); - return position.offset == 0 + assert( + position.offset == 1 || position.offset == 0 || position.offset == -1); + return position.offset <= 0 ? Offset.zero : Offset( size.width - (caretPrototype == null ? 0 : caretPrototype.width),