From fb4a6cabadedc2446a51b4b2a8576033de44f308 Mon Sep 17 00:00:00 2001 From: Helge Mahrt <5497139+helgemahrt@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:25:47 +0100 Subject: [PATCH] Ensure diagnostics indicator stays the right-most element on the left side of the status bar --- crates/zed/src/zed.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index ab924a74a6a2f..d905595a92545 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -241,7 +241,16 @@ fn update_vim_mode_indicator_position( status_bar.remove_item_at(mode_indicator_position, cx); match new_location { Some(ModeIndicatorLocation::Left) => { - status_bar.add_left_item(vim_mode_indicator, cx) + if let (Some(diagnostics_indicator), Some(diagnostics_indicator_position)) = + (status_bar.item_of_type::(), + status_bar.position_of_item::()) + { + status_bar.remove_item_at(diagnostics_indicator_position, cx); + status_bar.add_left_item(vim_mode_indicator, cx); + status_bar.add_left_item(diagnostics_indicator, cx); + } else { + status_bar.add_left_item(vim_mode_indicator, cx) + } } Some(ModeIndicatorLocation::Right) | None => { status_bar.add_right_item(vim_mode_indicator, cx)