Fix possibility of infinite loop in selections_with_autoclose_regions (#3138)
Previously, that method could loop forever if the editor's autoclose regions had unexpected selection ids. Something must have changed recently that allowed this invariant to be violated, but regardless, this code should not have relied on that invariant to terminate like this.
This commit is contained in:
parent
25d1939dcc
commit
99b776b593
1 changed files with 4 additions and 2 deletions
|
@ -2877,8 +2877,10 @@ impl Editor {
|
|||
i = 0;
|
||||
} else if pair_state.range.start.to_offset(buffer) > range.end {
|
||||
break;
|
||||
} else if pair_state.selection_id == selection.id {
|
||||
enclosing = Some(pair_state);
|
||||
} else {
|
||||
if pair_state.selection_id == selection.id {
|
||||
enclosing = Some(pair_state);
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue