Allow highlighting editor rows from multiple sources concurrently (#9153)

This commit is contained in:
Kirill Bulatov 2024-03-11 02:17:32 +02:00 committed by GitHub
parent f4a86e6fea
commit 41dc5fc412
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 590 additions and 45 deletions

View file

@ -81,8 +81,8 @@ impl Editor {
let mut target_top;
let mut target_bottom;
if let Some(highlighted_rows) = &self.highlighted_rows {
target_top = highlighted_rows.start as f32;
if let Some(first_highlighted_row) = &self.highlighted_display_rows(cx).first_entry() {
target_top = *first_highlighted_row.key() as f32;
target_bottom = target_top + 1.;
} else {
let selections = self.selections.all::<Point>(cx);
@ -205,10 +205,7 @@ impl Editor {
let mut target_left;
let mut target_right;
if self.highlighted_rows.is_some() {
target_left = px(0.);
target_right = px(0.);
} else {
if self.highlighted_rows.is_empty() {
target_left = px(f32::INFINITY);
target_right = px(0.);
for selection in selections {
@ -229,6 +226,9 @@ impl Editor {
);
}
}
} else {
target_left = px(0.);
target_right = px(0.);
}
target_right = target_right.min(scroll_width);