Skip to content

Commit

Permalink
Merge pull request #176 from milianw/fix-prev_sibling
Browse files Browse the repository at this point in the history
Fix prev_sibling indexing off-by-one
  • Loading branch information
lnicola authored Nov 22, 2024
2 parents de36433 + 84b1c8f commit e25dbdf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rowan"
version = "0.16.0"
version = "0.16.1"
authors = ["Aleksey Kladov <[email protected]>"]
repository = "https://github.com/rust-analyzer/rowan"
license = "MIT OR Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ impl NodeData {
let rev_siblings = self.green_siblings().enumerate().rev();
let index = rev_siblings.len().checked_sub(self.index() as usize)?;

rev_siblings.skip(index + 1).find_map(|(index, child)| {
rev_siblings.skip(index).find_map(|(index, child)| {
child.as_ref().into_node().and_then(|green| {
let parent = self.parent_node()?;
let offset = parent.offset() + child.rel_offset();
Expand Down

0 comments on commit e25dbdf

Please sign in to comment.