Skip to content

Commit 679ee93

Browse files
committed
Add comment about pixel alignment
1 parent 642bcc1 commit 679ee93

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

crates/egui/src/text_selection/visuals.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ pub fn paint_text_selection(
9696
pub fn paint_cursor_end(painter: &Painter, visuals: &Visuals, cursor_rect: Rect) {
9797
let stroke = visuals.text_cursor.stroke;
9898

99+
// Ensure the cursor is aligned to the pixel grid for whole number widths.
100+
// See https://github.com/emilk/egui/issues/5164
99101
let (top, bottom) = if (stroke.width as usize) % 2 == 0 {
100102
(
101103
painter.round_pos_to_pixels(cursor_rect.center_top()),

0 commit comments

Comments
 (0)