Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gluing a tag causes glue state to persist indefinitely #923

Open
benabutler opened this issue Dec 23, 2024 · 0 comments
Open

Gluing a tag causes glue state to persist indefinitely #923

benabutler opened this issue Dec 23, 2024 · 0 comments

Comments

@benabutler
Copy link

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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant