fix(rust): correct indices for Node::utf16_text

This commit is contained in:
Will Lillis 2025-07-16 00:27:18 -04:00
parent 32c88194f5
commit d3c2fed4b3
2 changed files with 14 additions and 1 deletions

View file

@ -2067,7 +2067,7 @@ impl<'tree> Node<'tree> {
#[must_use]
pub fn utf16_text<'a>(&self, source: &'a [u16]) -> &'a [u16] {
&source[self.start_byte()..self.end_byte()]
&source[self.start_byte() / 2..self.end_byte() / 2]
}
/// Create a new [`TreeCursor`] starting from this node.