Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editable elements are a repaint boundary #396

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/fleather/lib/src/rendering/editable_text_block.dart
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ class RenderEditableTextBlock extends RenderEditableContainerBox

// End RenderEditableBox implementation

@override
bool isRepaintBoundary = true;

@override
void detach() {
_painter?.dispose();
Expand Down
3 changes: 3 additions & 0 deletions packages/fleather/lib/src/rendering/editable_text_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,9 @@ class RenderEditableTextLine extends RenderEditableBox {

bool _attachedToCursorController = false;

@override
bool isRepaintBoundary = true;

@override
void attach(covariant PipelineOwner owner) {
super.attach(owner);
Expand Down
1 change: 1 addition & 0 deletions packages/fleather/lib/src/rendering/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@
_floatingCursorRect = null;
_cursorController.setFloatingCursorTextPosition(null);
}
markNeedsPaint();

Check warning on line 864 in packages/fleather/lib/src/rendering/editor.dart

View check run for this annotation

Codecov / codecov/patch

packages/fleather/lib/src/rendering/editor.dart#L864

Added line #L864 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've experiment with and without this line and saw no changes. Can you explain why it was added? And maybe add a test for that so we don't forget in the future?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The floating cursor stay until the next tap or edit action
In the video, notice the floating cursor that remains after releasing the floating cursor

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-08-16.at.18.23.14.mp4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I guess no need for a test. It would be really hard to test it I guess.

}

void _paintFloatingCursor(PaintingContext context, Offset offset) {
Expand Down
3 changes: 3 additions & 0 deletions packages/fleather/lib/src/rendering/embed_proxy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<TextBox> getBoxesForSelection(TextSelection selection) {
if (selection.isCollapsed) {
Expand Down
Loading