Skip to content

Commit

Permalink
[SuperEditor] Center caret based on width instead of expanding to the…
Browse files Browse the repository at this point in the history
… right
  • Loading branch information
Kevin Brendel committed May 5, 2024
1 parent 1085a3b commit 8482087
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ class CaretDocumentOverlayState extends DocumentLayoutLayerState<CaretDocumentOv
return null;
}

Rect caretRect = documentLayout.getEdgeForPosition(documentSelection.extent)!;
Rect caretRect =
documentLayout.getEdgeForPosition(documentSelection.extent)!.translate(-widget.caretStyle.width / 2, 0.0);

final overlayBox = context.findRenderObject() as RenderBox?;
if (overlayBox != null && overlayBox.hasSize && caretRect.left + widget.caretStyle.width >= overlayBox.size.width) {
Expand Down

0 comments on commit 8482087

Please sign in to comment.