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.

Fix bugs from recent PRs (#11147)

Mikayla Makif458f9067340
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 56c6ba395b3..c384f13bf0c 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -920,16 +920,21 @@ impl EditorElement {
em_width: Pixels,
autoscroll_containing_element: bool,
cx: &mut WindowContext,
- ) -> Vec<CursorLayout> {
+ ) -> (Vec<CursorLayout>, bool) {
let mut autoscroll_bounds = None;
+ let mut non_visible_cursors = false;
let cursor_layouts = self.editor.update(cx, |editor, cx| {
let mut cursors = Vec::new();
for (player_color, selections) in selections {
for selection in selections {
let cursor_position = selection.head;
- if (selection.is_local && !editor.show_local_cursors(cx))
- || !visible_display_row_range.contains(&cursor_position.row())
- {
+
+ let in_range = visible_display_row_range.contains(&cursor_position.row());
+ if !in_range {
+ non_visible_cursors |= true;
+ }
+
+ if (selection.is_local && !editor.show_local_cursors(cx)) || !in_range {
continue;
}
@@ -1036,7 +1041,7 @@ impl EditorElement {
cx.request_autoscroll(bounds);
}
- cursor_layouts
+ (cursor_layouts, non_visible_cursors)
}
fn layout_scrollbar(
@@ -3765,7 +3770,7 @@ impl Element for EditorElement {
let cursors = self.collect_cursors(&snapshot, cx);
- let visible_cursors = self.layout_visible_cursors(
+ let (visible_cursors, non_visible_cursors) = self.layout_visible_cursors(
&snapshot,
&selections,
start_row..end_row,
@@ -3785,7 +3790,7 @@ impl Element for EditorElement {
bounds,
scroll_position,
height_in_lines,
- cursors.len() > visible_cursors.len(),
+ non_visible_cursors,
cx,
);
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index 1a4b9d1e3ef..f096b0868e2 100644
--- a/crates/project_panel/src/project_panel.rs
+++ b/crates/project_panel/src/project_panel.rs
@@ -471,7 +471,8 @@ impl ProjectPanel {
.separator()
.action("Rename", Box::new(Rename))
.when(!is_root, |menu| {
- menu.action("Delete", Box::new(Delete { skip_prompt: false }))
+ menu.action("Trash", Box::new(Trash { skip_prompt: false }))
+ .action("Delete", Box::new(Delete { skip_prompt: false }))
})
.when(is_local & is_root, |menu| {
menu.separator()