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 omits \n from text results #62

Closed
blurymind opened this issue Apr 16, 2020 · 4 comments
Closed

Bondagejs omits \n from text results #62

blurymind opened this issue Apr 16, 2020 · 4 comments

Comments

@blurymind
Copy link
Collaborator

blurymind commented Apr 16, 2020

Basically this becomes a problem when you want

Case1 where you want the command to happen in the middle of a line, without breaking the line into two lines
1.my dialogue <<command>> happened\n

Case2 where the command happens between two lines

1. I am a line\n
2.<<command happened>>\n
3. I am another line\n

At the moment everyone trying to write a wrapper for bondagejs has no way of distinguishing between the two use cases, so we are forced to break dialogue lines when using a command in the middle of the dialogue or replace the command with a space.

We can't have predictable behaviour for both Case1 and Case2 input.

if bondagejs didn't omit the \n, the wrapper would at least know how to detect if the previous line ended with a \n and the wrapper to distinguish between case1 and case2

People using it in gdevelop keep filing bugs about it and there is no patchy way to fix it in the wrapper. It needs to be addressed here first to be fixed :/

We need some sort of a mechanic to detect if a text result starts at a new line or is continuing after a command on the same line

@blurymind
Copy link
Collaborator Author

A possible way to solve this is have yarn communicate to the wrapper the line number it got it's result from. We have data.body, why not also add data.lineNumber

@blurymind
Copy link
Collaborator Author

The end of line token is a null
https://github.com/hylyh/bondage.js/blob/master/src/lexer/tokens.js#L14
I wonder if that can be changed so we have some sort of a mechanic to track yarns line number where a result came from 🤔

@blurymind
Copy link
Collaborator Author

blurymind commented Apr 24, 2020

I submitted a PR to add the line coordinates data to text and command results.
#63

That should enable me to fix this on gdevelop, without resorting to hacky code

4ian/GDevelop#1671

@blurymind
Copy link
Collaborator Author

the fix was merged now, so closing this issue

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