text: Assert text anchor offset validity on construction (#38441)

Attempt to aid debugging some utf8 indexing issues

Release Notes:

- N/A

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
Lukas Wirth
2025-09-22 11:20:46 +00:00
committed by GitHub
co-authored by Mikayla Maki
parent 79620454d0
commit a2c71d3d20
5 changed files with 195 additions and 6 deletions
+2 -1
View File
@@ -5259,7 +5259,8 @@ impl MultiBufferSnapshot {
} else {
Anchor::max()
};
// TODO this is a hack, remove it
// TODO this is a hack, because all APIs should be able to handle ExcerptId::min and max.
if let Some((excerpt_id, _, _)) = self.as_singleton() {
anchor.excerpt_id = *excerpt_id;
}