Fix invalid anchors in breadcrumbs (#38687)

Release Notes:

- (nightly only) Fix panic when your cursor abuts a multibyte character
This commit is contained in:
Conrad Irwin
2025-09-23 02:38:12 +00:00
committed by GitHub
parent 681a4adc42
commit 98865a3ff2
3 changed files with 25 additions and 18 deletions
+15
View File
@@ -1052,6 +1052,21 @@ async fn test_symbols_containing(cx: &mut gpui::TestAppContext) {
})
.collect()
}
let (text, offsets) = marked_text_offsets(
&"
// ˇ😅 //
fn test() {
}
"
.unindent(),
);
let buffer = cx.new(|cx| Buffer::local(text, cx).with_language(Arc::new(rust_lang()), cx));
let snapshot = buffer.update(cx, |buffer, _| buffer.snapshot());
// note, it would be nice to actually return the method test in this
// case, but primarily asserting we don't crash because of the multibyte character.
assert_eq!(snapshot.symbols_containing(offsets[0], None), vec![]);
}
#[gpui::test]