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
@@ -140,8 +140,8 @@ impl TextSize {
|
||||
Self::Default => rems_from_px(14.),
|
||||
Self::Small => rems_from_px(12.),
|
||||
Self::XSmall => rems_from_px(10.),
|
||||
Self::Ui => rems_from_px(theme_settings.ui_font_size(cx).into()),
|
||||
Self::Editor => rems_from_px(theme_settings.buffer_font_size(cx).into()),
|
||||
Self::Ui => rems_from_px(theme_settings.ui_font_size(cx)),
|
||||
Self::Editor => rems_from_px(theme_settings.buffer_font_size(cx)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ pub const BASE_REM_SIZE_IN_PX: f32 = 16.;
|
||||
///
|
||||
/// For instance, instead of writing `rems(0.875)` you can write `rems_from_px(14.)`
|
||||
#[inline(always)]
|
||||
pub fn rems_from_px(px: f32) -> Rems {
|
||||
rems(px / BASE_REM_SIZE_IN_PX)
|
||||
pub fn rems_from_px(px: impl Into<f32>) -> Rems {
|
||||
rems(px.into() / BASE_REM_SIZE_IN_PX)
|
||||
}
|
||||
|
||||
/// Returns a [`Length`] corresponding to the specified percentage of the viewport's width.
|
||||
|
||||
Reference in New Issue
Block a user