inkle / inkle/ink

Gluing a tag causes glue state to persist indefinitely

Open
#923 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.9k
Forks
540
PR merge metrics
No merged PRs in 30d

Description

While trying to use glue to append tags to a line, I found some odd behavior in v1.2.0. Gluing a line that only contains a tag seems to cause Ink to get stuck in glue mode until the next choice point. This snippet:
```
What happens if we glue in a line that only contains a tag?
<> # This is the tag of doom
Bad things.
Uh-oh.
```
produces the following:
```
What happens if we glue in a line that only contains a tag? Bad things.Uh-oh.
# This is the tag of doom
```

All subsequent lines will be glued in without whitespace until the next choice point, including across diverts or function calls.

This also happens when the line is only empty because of a conditional result (even if the tag is in the conditional):
```
Conditionally glue in some text with a tag.
<> {false: some text #with a tag}
Oh no
It's happening again
```
yields
```
Conditionally glue in some text with a tag. Oh noIt's happening again
```

The bug can be worked around by simply avoiding glue on tagged lines that may not contain text and instead putting all tag logic on the same line as the tagged content, but being able to split conditional logic across multiple lines is a lot more readable, e.g.:
```
My line
{ ShouldApplyTag1: <> # tag1}
{ ShouldApplyTag2: <> # tag2}
{ ShouldApplyTag3: <> # tag3}
{ ShouldApplyTag4: <> # tag4}
```
vs.
```
My line { ShouldApplyTag1: # tag1} { ShouldApplyTag2: # tag2} { ShouldApplyTag3: # tag3} { ShouldApplyTag4: # tag4}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.