editor: Represent scroll offset with more precision (#39367)
Closes #5355 Release Notes: - Fixed rendering glitches with files with more than 16 million lines (that occured due to floating number rounding errors). --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
This commit is contained in:
co-authored by
Smit Barmase
parent
4c35274b6e
commit
d359a814f8
@@ -121,9 +121,9 @@ fn scroll_editor(
|
||||
let amount = match (amount.is_full_page(), editor.visible_line_count()) {
|
||||
(true, Some(visible_line_count)) => {
|
||||
if amount.direction().is_upwards() {
|
||||
ScrollAmount::Line(amount.lines(visible_line_count) + 1.0)
|
||||
ScrollAmount::Line((amount.lines(visible_line_count) + 1.0) as f32)
|
||||
} else {
|
||||
ScrollAmount::Line(amount.lines(visible_line_count) - 1.0)
|
||||
ScrollAmount::Line((amount.lines(visible_line_count) - 1.0) as f32)
|
||||
}
|
||||
}
|
||||
_ => amount,
|
||||
@@ -308,7 +308,7 @@ mod test {
|
||||
let window = cx.window;
|
||||
let margin = cx
|
||||
.update_window(window, |_, window, _cx| {
|
||||
window.viewport_size().height - line_height * visible_line_count
|
||||
window.viewport_size().height - line_height * visible_line_count as f32
|
||||
})
|
||||
.unwrap();
|
||||
cx.simulate_window_resize(
|
||||
|
||||
Reference in New Issue
Block a user