Skip to content

Commit f4c9afa

Browse files
authored
Fix cursor rectangle calculation for last line (#547)
this fixes #534 so that the cursor goes to the right position or an empty line when alignment is center or right
1 parent df7cedc commit f4c9afa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

parley/src/editing/cursor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,9 @@ fn last_line_cursor_rect<B: Brush>(layout: &Layout<B>, size: f32) -> BoundingBox
453453
if let Some(line) = layout.get(layout.len().saturating_sub(1)) {
454454
let metrics = line.metrics();
455455
BoundingBox::new(
456-
0.0,
456+
metrics.offset as f64,
457457
metrics.min_coord as f64,
458-
size as f64,
458+
(metrics.offset + size) as f64,
459459
metrics.max_coord as f64,
460460
)
461461
} else {

0 commit comments

Comments
 (0)