Open KevinBrendel opened 5 months ago
This looks to be a Flutter bug. The TextPainter.getFullHeightForCaret
is reporting incorrect results spans with multiple styles
There is an open issue tracking that: https://github.com/flutter/flutter/issues/150638
This seems to be fixed in Flutter master channel. Could you please confirm it @KevinBrendel ?
@angelosilvestre Can confirm it is mostly fixed in my example app using the Flutter master channel. The caret is now correctly sized when placed between small or large letters.
Some weird situations in edge cases:
When the cursor is between the small and the large text, it is small. So it seemingly uses the size of the next character, instead of the size of the previous character, which seems to be more common in other writing apps (e.g. Word, Google Docs):
@KevinBrendel could you please test this again on the latest main? We merged some changes related to the font size when placing the caret at the end of a word.
@angelosilvestre On the latest SuperEditor main with the latest Flutter master channel, the behavior seems inconsistent. Depending on how the cursor is positioned there, it can either have the correct height or the wrong height. Positioning it via the keyboard seems to more often result in the wrong height, whereas with the mouse it seems dependent on the exact click location.
https://github.com/user-attachments/assets/7fb77da3-24e8-4833-a042-1092c21c36fe
@KevinBrendel This might be related to https://github.com/flutter/flutter/issues/155330
Package Version super_editor, GitHub, stable branch
User Info coneno GmbH, QuikFlow
To Reproduce Steps to reproduce the behavior:
Minimal Reproduction Code
Minimal, Runnable Code Sample
```dart import 'package:flutter/material.dart'; import 'package:super_editor/super_editor.dart'; void main() { runApp(const MainApp()); } class MainApp extends StatefulWidget { const MainApp({super.key}); @override StateActual behavior The caret is the same height as it would be for the text without the attribution, and is positioned on the top of the line.
Expected behavior The caret is sized based on the actual visible font-size of the characters surrounding it. E.g. in Google Docs it seems to use the font-size of the preceding character.
Platform macOS
Flutter version Flutter 3.22.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision 761747bfc5 (7 days ago) • 2024-06-05 22:15:13 +0200 Engine • revision edd8546116 Tools • Dart 3.4.3 • DevTools 2.34.3.
Screenshots