Closed jpnurmi closed 11 months ago
Similarly, while erasing, an extra backspace press is required.
https://github.com/slint-ui/slint/assets/140617/6367572d-4bdc-43b5-9f07-ca972784dcab
The text boxes returned by SkParagraph::getRectsForRange()
that are used for calculating the cursor rectangle don't quite match with SkParagrap::getLineMetrics()
, at least when there's a singular trailing newline. For example, "Hello"
and "Hello\n"
are both presented as a single identical text box.
"Hello"
"Hello"
(0..5): l=0.000000, t=-0.296875, r=35.490002, b=16.000000
"Hello\n"
"Hello\n"
(0..6): l=0.000000, t=-0.296875, r=35.490002, b=16.000000"\n"
(5..6): l=0.000000, t=15.703125, r=0.000000, b=32.000000
"Hello\n\n"
"Hello"
(0..5): l=0.000000, t=-0.296875, r=35.490002, b=16.000000"\n"
(6..7): l=0.000000, t=15.703125, r=0.000000, b=32.000000"\n"
(6..7): l=0.000000, t=31.703125, r=0.000000, b=48.000000
"Hello\nworld\n"
"Hello"
(0..5): l=0.000000, t=-0.296875, r=35.490002, b=16.000000"world\n"
(6..12): l=0.000000, t=15.703125, r=38.549999, b=32.000000"\n"
(11..12): l=0.000000, t=31.703125, r=0.000000, b=48.000000
"Hello\n \n"
"Hello"
(0..5): l=0.000000, t=-0.296875, r=35.490002, b=16.000000" \n"
(6..8): l=0.000000, t=15.703125, r=0.000000, b=32.000000"\n"
(7..8): l=0.000000, t=31.703125, r=0.000000, b=48.000000
Originally posted by @jpnurmi in https://github.com/slint-ui/slint/issues/3588#issuecomment-1742847367
Latest master (e44f70c9dfcf0379390b5f8886764e38c2bf9c25), macOS, winit-skia