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

bondagejs clips an empty space from text nodes that come after <<command>> nodes #61

Open
blurymind opened this issue Mar 6, 2020 · 3 comments

Comments

@blurymind
Copy link
Collaborator

blurymind commented Mar 6, 2020

Basically if you write something like
Hello friends<<echo>> wow
bondagejs will clip the space that comes before wow
and the player will see as text
Hello friendswow

This is not quite as noticeable in bondagejs online demo, since it adds different nodes as new lines, but it is quite noticeable in gdevelop, where it has been reported at the forum
https://forum.gdevelop-app.com/t/yarn-lines-of-text-merging-together-when-using-commands-on-the-yarn-node/21452/11

The way I fixed it for now in gdevelop's wrapper using bondagejs is by adding an empty space to the printed text whenever a command is called. That makes it less noticeable, but doesnt make it go away :)

The issue can be viewed on bondagejs' online demo

@blurymind
Copy link
Collaborator Author

I tried to fix this in bondagejs, but I couldnt figure out what was eating that space at the start of text nodes that come after a command

@ghost
Copy link

ghost commented Aug 21, 2020

It's the lexer and I've run into the same issue while implementing inline expressions. I'm working on a solution.

As of today, the code is in lexer.js

      const spaceMatch = this.getCurrentLine().substring(this.yylloc.last_column - 1)
                                              .match(/^\s*/);

      if (spaceMatch.length !== 0) {
        this.yylloc.last_column += spaceMatch[0].length;
      }

@ghost
Copy link

ghost commented Aug 22, 2020

I've create a kludgey workaround that is now in my fork. https://github.com/alforno/bondage.js/commit/eeddb49def38d16f8bb0c54ad21e0b5c684784d9

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