agent: Fix bug where wrong crease for @mention would be displayed (#28558)

Release Notes:

- agent: Fix a bug where an inserted @mention did not show up as the one
that was selected
This commit is contained in:
Bennet Bo Fenner 2025-04-10 20:04:03 -06:00 committed by GitHub
parent c124838a73
commit 5757e352b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 20 deletions

View file

@ -509,14 +509,13 @@ fn recent_context_picker_entries(
recent
}
pub(crate) fn insert_crease_for_mention(
pub(crate) fn insert_fold_for_mention(
excerpt_id: ExcerptId,
crease_start: text::Anchor,
content_len: usize,
crease_label: SharedString,
crease_icon_path: SharedString,
editor_entity: Entity<Editor>,
window: &mut Window,
cx: &mut App,
) {
editor_entity.update(cx, |editor, cx| {
@ -535,6 +534,7 @@ pub(crate) fn insert_crease_for_mention(
crease_label,
editor_entity.downgrade(),
),
merge_adjacent: false,
..Default::default()
};
@ -548,8 +548,9 @@ pub(crate) fn insert_crease_for_mention(
render_trailer,
);
editor.insert_creases(vec![crease.clone()], cx);
editor.fold_creases(vec![crease], false, window, cx);
editor.display_map.update(cx, |display_map, cx| {
display_map.fold(vec![crease], cx);
});
});
}