Properly calculate expanded git diff hunk highlight ranges (#11632)

Closes https://github.com/zed-industries/zed/issues/11576

Release Notes:

- Fixed expanded diff hunks highlighting an extra row as added
([11576](https://github.com/zed-industries/zed/issues/11576))
This commit is contained in:
Kirill Bulatov 2024-05-10 02:02:56 +03:00 committed by GitHub
parent 50c45c7897
commit 4762e52d31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 161 additions and 121 deletions

View file

@ -142,7 +142,7 @@ impl OutlineViewDelegate {
self.active_editor.update(cx, |active_editor, cx| {
active_editor.clear_row_highlights::<OutlineRowHighlights>();
active_editor.highlight_rows::<OutlineRowHighlights>(
outline_item.range.clone(),
outline_item.range.start..=outline_item.range.end,
Some(cx.theme().colors().editor_highlighted_line_background),
cx,
);
@ -243,7 +243,7 @@ impl PickerDelegate for OutlineViewDelegate {
.and_then(|highlights| highlights.into_iter().next().map(|(rows, _)| rows.clone()))
{
active_editor.change_selections(Some(Autoscroll::center()), cx, |s| {
s.select_ranges([rows.start..rows.start])
s.select_ranges([*rows.start()..*rows.start()])
});
active_editor.clear_row_highlights::<OutlineRowHighlights>();
active_editor.focus(cx);