Avoid division by zero in grapheme_position

This commit is contained in:
Héctor Ramón Jiménez 2024-01-11 08:32:30 +01:00
parent 9c50a7ed7e
commit 3d88ceb482
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -219,7 +219,7 @@ impl core::text::Paragraph for Paragraph {
glyph.w
* (1.0
- graphemes_seen.saturating_sub(index) as f32
/ last_grapheme_count as f32)
/ last_grapheme_count.max(1) as f32)
};
Some(Point::new(