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:
parent
39fb1d567d
commit
f458f90673
2 changed files with 14 additions and 8 deletions
|
@ -920,16 +920,21 @@ impl EditorElement {
|
||||||
em_width: Pixels,
|
em_width: Pixels,
|
||||||
autoscroll_containing_element: bool,
|
autoscroll_containing_element: bool,
|
||||||
cx: &mut WindowContext,
|
cx: &mut WindowContext,
|
||||||
) -> Vec<CursorLayout> {
|
) -> (Vec<CursorLayout>, bool) {
|
||||||
let mut autoscroll_bounds = None;
|
let mut autoscroll_bounds = None;
|
||||||
|
let mut non_visible_cursors = false;
|
||||||
let cursor_layouts = self.editor.update(cx, |editor, cx| {
|
let cursor_layouts = self.editor.update(cx, |editor, cx| {
|
||||||
let mut cursors = Vec::new();
|
let mut cursors = Vec::new();
|
||||||
for (player_color, selections) in selections {
|
for (player_color, selections) in selections {
|
||||||
for selection in selections {
|
for selection in selections {
|
||||||
let cursor_position = selection.head;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1036,7 +1041,7 @@ impl EditorElement {
|
||||||
cx.request_autoscroll(bounds);
|
cx.request_autoscroll(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor_layouts
|
(cursor_layouts, non_visible_cursors)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn layout_scrollbar(
|
fn layout_scrollbar(
|
||||||
|
@ -3765,7 +3770,7 @@ impl Element for EditorElement {
|
||||||
|
|
||||||
let cursors = self.collect_cursors(&snapshot, cx);
|
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,
|
&snapshot,
|
||||||
&selections,
|
&selections,
|
||||||
start_row..end_row,
|
start_row..end_row,
|
||||||
|
@ -3785,7 +3790,7 @@ impl Element for EditorElement {
|
||||||
bounds,
|
bounds,
|
||||||
scroll_position,
|
scroll_position,
|
||||||
height_in_lines,
|
height_in_lines,
|
||||||
cursors.len() > visible_cursors.len(),
|
non_visible_cursors,
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -471,7 +471,8 @@ impl ProjectPanel {
|
||||||
.separator()
|
.separator()
|
||||||
.action("Rename", Box::new(Rename))
|
.action("Rename", Box::new(Rename))
|
||||||
.when(!is_root, |menu| {
|
.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| {
|
.when(is_local & is_root, |menu| {
|
||||||
menu.separator()
|
menu.separator()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue