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
@@ -14,7 +14,7 @@ use std::sync::Arc;
|
||||
use ui::{ContextMenu, Divider, DividerColor, IconButton, Tooltip, h_flex};
|
||||
use ui::{prelude::*, right_click_menu};
|
||||
|
||||
pub(crate) const RESIZE_HANDLE_SIZE: Pixels = Pixels(6.);
|
||||
pub(crate) const RESIZE_HANDLE_SIZE: Pixels = px(6.);
|
||||
|
||||
pub enum PanelEvent {
|
||||
ZoomIn,
|
||||
@@ -732,7 +732,7 @@ impl Dock {
|
||||
}
|
||||
|
||||
pub fn clamp_panel_size(&mut self, max_size: Pixels, window: &mut Window, cx: &mut App) {
|
||||
let max_size = px((max_size.0 - RESIZE_HANDLE_SIZE.0).abs());
|
||||
let max_size = (max_size - RESIZE_HANDLE_SIZE).abs();
|
||||
for panel in self.panel_entries.iter().map(|entry| &entry.panel) {
|
||||
if panel.size(window, cx) > max_size {
|
||||
panel.set_size(Some(max_size.max(RESIZE_HANDLE_SIZE)), window, cx);
|
||||
|
||||
@@ -1259,11 +1259,11 @@ mod element {
|
||||
origin: child
|
||||
.bounds
|
||||
.origin
|
||||
.apply_along(Axis::Horizontal, |val| val + Pixels(1.)),
|
||||
.apply_along(Axis::Horizontal, |val| val + px(1.)),
|
||||
size: child
|
||||
.bounds
|
||||
.size
|
||||
.apply_along(Axis::Horizontal, |val| val - Pixels(1.)),
|
||||
.apply_along(Axis::Horizontal, |val| val - px(1.)),
|
||||
};
|
||||
|
||||
if overlay_opacity.is_some()
|
||||
|
||||
@@ -252,7 +252,7 @@ impl sqlez::bindable::Bind for SerializedPixels {
|
||||
statement: &sqlez::statement::Statement,
|
||||
start_index: i32,
|
||||
) -> anyhow::Result<i32> {
|
||||
let this: i32 = self.0.0 as i32;
|
||||
let this: i32 = u32::from(self.0) as _;
|
||||
this.bind(statement, start_index)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5989,7 +5989,7 @@ impl Workspace {
|
||||
self.left_dock.read_with(cx, |left_dock, cx| {
|
||||
let left_dock_size = left_dock
|
||||
.active_panel_size(window, cx)
|
||||
.unwrap_or(Pixels(0.0));
|
||||
.unwrap_or(Pixels::ZERO);
|
||||
if left_dock_size + size > self.bounds.right() {
|
||||
size = self.bounds.right() - left_dock_size
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user