Revert "editor: Add FlexClipped block style and use it for spacer blocks" (#49508)
Reverts zed-industries/zed#49478
This commit is contained in:
1 parent
bf1bb52b60
commit
f63e4fbdef
2 files changed
+9
-32
No files matched your search
@@ -265,8 +265,6 @@ impl<P: Debug> Debug for BlockProperties<P> {
|
||||
pub enum BlockStyle {
|
||||
Fixed,
|
||||
Flex,
|
||||
/// Like `Flex` but doesn't use the gutter
|
||||
FlexClipped,
|
||||
Sticky,
|
||||
}
|
||||
|
||||
@@ -274,7 +272,6 @@ pub enum BlockStyle {
|
||||
pub struct EditorMargins {
|
||||
pub gutter: GutterDimensions,
|
||||
pub right: Pixels,
|
||||
pub extended_right: Pixels,
|
||||
}
|
||||
|
||||
#[derive(gpui::AppContext, gpui::VisualContext)]
|
||||
@@ -396,8 +393,8 @@ impl Block {
|
||||
Block::Custom(block) => block.style,
|
||||
Block::ExcerptBoundary { .. }
|
||||
| Block::FoldedBuffer { .. }
|
||||
| Block::BufferHeader { .. } => BlockStyle::Sticky,
|
||||
Block::Spacer { .. } => BlockStyle::FlexClipped,
|
||||
| Block::BufferHeader { .. }
|
||||
| Block::Spacer { .. } => BlockStyle::Sticky,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1710,7 +1707,7 @@ pub(crate) fn balancing_block(
|
||||
Some(BlockProperties {
|
||||
placement: their_placement,
|
||||
height: my_block.height,
|
||||
style: BlockStyle::FlexClipped,
|
||||
style: BlockStyle::Sticky,
|
||||
render: Arc::new(move |cx| {
|
||||
crate::EditorElement::render_spacer_block(
|
||||
cx.block_id,
|
||||
|
||||
@@ -4226,15 +4226,7 @@ impl EditorElement {
|
||||
.size
|
||||
.width
|
||||
.max(fixed_block_max_width)
|
||||
.max(
|
||||
editor_margins.gutter.width + *scroll_width + editor_margins.extended_right,
|
||||
)
|
||||
.into(),
|
||||
(BlockStyle::FlexClipped, _) => hitbox
|
||||
.size
|
||||
.width
|
||||
.max(fixed_block_max_width)
|
||||
.max(*scroll_width + editor_margins.extended_right)
|
||||
.max(editor_margins.gutter.width + *scroll_width)
|
||||
.into(),
|
||||
(BlockStyle::Fixed, _) => unreachable!(),
|
||||
};
|
||||
@@ -4277,7 +4269,7 @@ impl EditorElement {
|
||||
element,
|
||||
available_space: size(width, element_size.height.into()),
|
||||
style,
|
||||
overlaps_gutter: !block.place_near() && style != BlockStyle::FlexClipped,
|
||||
overlaps_gutter: !block.place_near(),
|
||||
is_buffer_header: block.is_buffer_header(),
|
||||
});
|
||||
}
|
||||
@@ -4291,17 +4283,12 @@ impl EditorElement {
|
||||
let style = block.style();
|
||||
let width = match style {
|
||||
BlockStyle::Fixed => AvailableSpace::MinContent,
|
||||
BlockStyle::Flex => {
|
||||
AvailableSpace::Definite(hitbox.size.width.max(fixed_block_max_width).max(
|
||||
editor_margins.gutter.width + *scroll_width + editor_margins.extended_right,
|
||||
))
|
||||
}
|
||||
BlockStyle::FlexClipped => AvailableSpace::Definite(
|
||||
BlockStyle::Flex => AvailableSpace::Definite(
|
||||
hitbox
|
||||
.size
|
||||
.width
|
||||
.max(fixed_block_max_width)
|
||||
.max(*scroll_width + editor_margins.extended_right),
|
||||
.max(editor_margins.gutter.width + *scroll_width),
|
||||
),
|
||||
BlockStyle::Sticky => AvailableSpace::Definite(hitbox.size.width),
|
||||
};
|
||||
@@ -4361,7 +4348,6 @@ impl EditorElement {
|
||||
&self,
|
||||
blocks: &mut Vec<BlockLayout>,
|
||||
hitbox: &Hitbox,
|
||||
gutter_hitbox: &Hitbox,
|
||||
line_height: Pixels,
|
||||
scroll_position: gpui::Point<ScrollOffset>,
|
||||
scroll_pixel_position: gpui::Point<ScrollPixelOffset>,
|
||||
@@ -4383,10 +4369,6 @@ impl EditorElement {
|
||||
hitbox.origin + point(Pixels::ZERO, hitbox.size.height)
|
||||
};
|
||||
|
||||
if block.style == BlockStyle::FlexClipped {
|
||||
origin += point(gutter_hitbox.size.width, Pixels::ZERO);
|
||||
}
|
||||
|
||||
if !matches!(block.style, BlockStyle::Sticky) {
|
||||
origin += point(Pixels::from(-scroll_pixel_position.x), Pixels::ZERO);
|
||||
}
|
||||
@@ -9599,12 +9581,11 @@ impl Element for EditorElement {
|
||||
|
||||
let right_margin = minimap_width + vertical_scrollbar_width;
|
||||
|
||||
let extended_right = 2 * em_width + right_margin;
|
||||
let editor_width = text_width - gutter_dimensions.margin - extended_right;
|
||||
let editor_width =
|
||||
text_width - gutter_dimensions.margin - 2 * em_width - right_margin;
|
||||
let editor_margins = EditorMargins {
|
||||
gutter: gutter_dimensions,
|
||||
right: right_margin,
|
||||
extended_right,
|
||||
};
|
||||
|
||||
snapshot = self.editor.update(cx, |editor, cx| {
|
||||
@@ -10488,7 +10469,6 @@ impl Element for EditorElement {
|
||||
self.layout_blocks(
|
||||
&mut blocks,
|
||||
&hitbox,
|
||||
&gutter_hitbox,
|
||||
line_height,
|
||||
scroll_position,
|
||||
scroll_pixel_position,
|
||||
|
||||
Reference in new issue
Block a user