From 0f3677658d71aaa1f35867df6e374e005b8664b2 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Thu, 17 Sep 2015 05:51:38 -0400 Subject: [PATCH] Changing content used for empty match When an empty expression is used in alternation with something else (such as `(|test)`) the empty expression was using its empty group as a placeholder element for calculating its anchor position. This calculation was incorrect and was leading to the alternation not being centered vertically. Using any element with height and width fixes this. Fixes #16 --- src/js/parser/javascript/match.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/parser/javascript/match.js b/src/js/parser/javascript/match.js index 4ed45b4..476042f 100644 --- a/src/js/parser/javascript/match.js +++ b/src/js/parser/javascript/match.js @@ -62,8 +62,11 @@ export default { // This leads to a Match node with no fragments, no start indicator, and // no end indicator. Something must be rendered so that the anchor can be // calculated based on it. + // + // Furthermore, the content rendered must have height and width or else the + // anchor calculations fail. if (items.length === 0) { - items = [this.container.group()]; + items = [this.container.group().path('M0,0h10')]; } return Promise.all(items)