From 9798d06141c10b75a1e5620601e99ca8b02b78ee Mon Sep 17 00:00:00 2001 From: Alan Mantoux Date: Sat, 10 Aug 2024 19:49:09 +0200 Subject: [PATCH 1/2] EditableTextLine is a repaint boundary --- packages/fleather/lib/src/rendering/editable_text_block.dart | 3 +++ packages/fleather/lib/src/rendering/editable_text_line.dart | 3 +++ packages/fleather/lib/src/rendering/embed_proxy.dart | 3 +++ 3 files changed, 9 insertions(+) diff --git a/packages/fleather/lib/src/rendering/editable_text_block.dart b/packages/fleather/lib/src/rendering/editable_text_block.dart index 5dfe79cc..09de4b24 100644 --- a/packages/fleather/lib/src/rendering/editable_text_block.dart +++ b/packages/fleather/lib/src/rendering/editable_text_block.dart @@ -273,6 +273,9 @@ class RenderEditableTextBlock extends RenderEditableContainerBox // End RenderEditableBox implementation + @override + bool isRepaintBoundary = true; + @override void detach() { _painter?.dispose(); diff --git a/packages/fleather/lib/src/rendering/editable_text_line.dart b/packages/fleather/lib/src/rendering/editable_text_line.dart index 32303c8c..e3073a88 100644 --- a/packages/fleather/lib/src/rendering/editable_text_line.dart +++ b/packages/fleather/lib/src/rendering/editable_text_line.dart @@ -519,6 +519,9 @@ class RenderEditableTextLine extends RenderEditableBox { bool _attachedToCursorController = false; + @override + bool isRepaintBoundary = true; + @override void attach(covariant PipelineOwner owner) { super.attach(owner); diff --git a/packages/fleather/lib/src/rendering/embed_proxy.dart b/packages/fleather/lib/src/rendering/embed_proxy.dart index aebc7c38..ede2c4c6 100644 --- a/packages/fleather/lib/src/rendering/embed_proxy.dart +++ b/packages/fleather/lib/src/rendering/embed_proxy.dart @@ -9,6 +9,9 @@ import 'editable_box.dart'; class RenderEmbedProxy extends RenderProxyBox implements RenderContentProxyBox { RenderEmbedProxy({RenderBox? child}) : super(child); + @override + bool isRepaintBoundary = true; + @override List getBoxesForSelection(TextSelection selection) { if (selection.isCollapsed) { From bd6401340d3c9f7eeaa3063be361ca6ed203e330 Mon Sep 17 00:00:00 2001 From: Alan Mantoux Date: Sat, 10 Aug 2024 20:14:24 +0200 Subject: [PATCH 2/2] Repaint editor when floating cursor changes --- packages/fleather/lib/src/rendering/editor.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/fleather/lib/src/rendering/editor.dart b/packages/fleather/lib/src/rendering/editor.dart index 3fc17cb7..14894560 100644 --- a/packages/fleather/lib/src/rendering/editor.dart +++ b/packages/fleather/lib/src/rendering/editor.dart @@ -861,6 +861,7 @@ class RenderEditor extends RenderEditableContainerBox _floatingCursorRect = null; _cursorController.setFloatingCursorTextPosition(null); } + markNeedsPaint(); } void _paintFloatingCursor(PaintingContext context, Offset offset) {