Fix bugs from recent PRs (#11147)

Fix missed delete in project panel
Fix blinking scrollbar from selections-in-scrollbar change

Release Notes:

- N/A (nightly only)
This commit is contained in:
Mikayla Maki
2024-04-28 20:56:17 -07:00
committed by GitHub
parent 39fb1d567d
commit f458f90673
2 changed files with 14 additions and 8 deletions
+12 -7
View File
@@ -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,
);
+2 -1
View File
@@ -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()