mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Fix incremental group bug
This commit is contained in:
parent
6a6753cb69
commit
e32e9faa53
@ -690,5 +690,7 @@ mod tests {
|
||||
test("[hello]", 2 .. 3, "]", 0 .. 7);
|
||||
test("{a}", 1 .. 2, "b", 1 .. 2);
|
||||
test("{ a; b; c }", 5 .. 6, "[}]", 0 .. 13);
|
||||
test("#a()\n~", 3..4, "{}", 0..7);
|
||||
test("[]\n~", 1..2, "#if i==0 {true}", 0..18);
|
||||
}
|
||||
}
|
||||
|
@ -267,11 +267,6 @@ impl<'s> Parser<'s> {
|
||||
/// This panics if no group was started.
|
||||
#[track_caller]
|
||||
pub fn end_group(&mut self) {
|
||||
// If another group closes after a group with the missing terminator,
|
||||
// its scope of influence ends here and no longer taints the rest of the
|
||||
// reparse.
|
||||
self.unterminated_group = false;
|
||||
|
||||
let group_mode = self.tokens.mode();
|
||||
let group = self.groups.pop().expect("no started group");
|
||||
self.tokens.set_mode(group.prev_mode);
|
||||
@ -289,6 +284,11 @@ impl<'s> Parser<'s> {
|
||||
Group::Imports => None,
|
||||
} {
|
||||
if self.current.as_ref() == Some(&end) {
|
||||
// If another group closes after a group with the missing terminator,
|
||||
// its scope of influence ends here and no longer taints the rest of the
|
||||
// reparse.
|
||||
self.unterminated_group = false;
|
||||
|
||||
// Bump the delimeter and return. No need to rescan in this
|
||||
// case. Also, we know that the delimiter is not stray even
|
||||
// though we already removed the group.
|
||||
|
Loading…
x
Reference in New Issue
Block a user