From e57e617bb9bd5ceaec8871aad444b7c1714faefe Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Mon, 10 Mar 2025 18:43:26 +0100 Subject: [PATCH] fixed groups with _ret --- src/diagram.typ | 10 +++++++--- src/utils.typ | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/diagram.typ b/src/diagram.typ index b286ffc..0e78117 100644 --- a/src/diagram.typ +++ b/src/diagram.typ @@ -46,7 +46,6 @@ while i < elmts.len() { let elmt = elmts.at(i) if elmt.type == "grp" { - let grp-elmts = elmt.elmts elmt.elmts = elmt.elmts.map(e => { if e.type == "seq" { if e.p1 == "?" { @@ -60,12 +59,17 @@ elmts.at(i) = elmt elmts = ( elmts.slice(0, i + 1) + - grp-elmts + + elmt.elmts + (( - type: "grp-end" + type: "grp-end", + start-i: i ),) + elmts.slice(i+1) ) + } else if elmt.type == "grp-end" { + // Put back elements in group because they might have changed + elmts.at(elmt.start-i).elmts = elmts.slice(elmt.start-i + 1, i) + } else if elmt.type == "seq" { if elmt.enable-dst { activation-history.push(elmt) diff --git a/src/utils.typ b/src/utils.typ index a97a3b5..e8d750d 100644 --- a/src/utils.typ +++ b/src/utils.typ @@ -36,6 +36,9 @@ max-i = calc.max(max-i, i1) } } + if max-i < min-i { + (min-i, max-i) = (max-i, min-i) + } return (min-i, max-i) }