diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 915524f932..b1eabec4b5 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1512,6 +1512,17 @@ impl EditorElement { ShowScrollbar::Never => return None, }; + // The horizontal scrollbar is usually slightly offset to align nicely with + // indent guides. However, this offset is not needed if indent guides are + // disabled for the current editor. + let content_offset = self + .editor + .read(cx) + .show_indent_guides + .is_none_or(|should_show| should_show) + .then_some(content_offset) + .unwrap_or_default(); + Some(EditorScrollbars::from_scrollbar_axes( ScrollbarAxes { horizontal: scrollbar_settings.axes.horizontal