Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Git status list fix (#59155)

Eugene13dd39b4e436
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index cbe40e24b6f..79a42c8ae34 100644
--- a/crates/git_ui/src/git_panel.rs
+++ b/crates/git_ui/src/git_panel.rs
@@ -1383,6 +1383,14 @@ impl GitPanel {
}
}
+ fn select_last_entry_if_out_of_bounds(&mut self, window: &mut Window, cx: &mut Context<Self>) {
+ if let Some(idx) = self.selected_entry
+ && idx >= self.entries.len()
+ {
+ self.select_last(&menu::SelectLast, window, cx);
+ }
+ }
+
fn focus_changes_list(
&mut self,
_: &FocusChanges,
@@ -4076,6 +4084,7 @@ impl GitPanel {
}
self.select_first_entry_if_none(window, cx);
+ self.select_last_entry_if_out_of_bounds(window, cx);
let suggested_commit_message = self.suggest_commit_message(cx);
let placeholder_text = suggested_commit_message.unwrap_or("Enter commit message".into());