Skip to content

Commit 3da4cdd

Browse files
Round the scroll offset in editor to fix jumping text (#40401)
Release Notes: - Improved editor font rendering on lodpi displays Co-authored-by: John Tur <john-tur@outlook.com>
1 parent 25172f9 commit 3da4cdd

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

crates/editor/src/element.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7212,9 +7212,16 @@ impl EditorElement {
72127212
* ScrollPixelOffset::from(max_glyph_advance)
72137213
- ScrollPixelOffset::from(delta.x * scroll_sensitivity))
72147214
/ ScrollPixelOffset::from(max_glyph_advance);
7215-
let y = (current_scroll_position.y * ScrollPixelOffset::from(line_height)
7215+
7216+
let scale_factor = window.scale_factor();
7217+
let y = (current_scroll_position.y
7218+
* ScrollPixelOffset::from(line_height)
7219+
* ScrollPixelOffset::from(scale_factor)
72167220
- ScrollPixelOffset::from(delta.y * scroll_sensitivity))
7217-
/ ScrollPixelOffset::from(line_height);
7221+
.round()
7222+
/ ScrollPixelOffset::from(line_height)
7223+
/ ScrollPixelOffset::from(scale_factor);
7224+
72187225
let mut scroll_position =
72197226
point(x, y).clamp(&point(0., 0.), &position_map.scroll_max);
72207227
let forbid_vertical_scroll = editor.scroll_manager.forbid_vertical_scroll();

0 commit comments

Comments
 (0)