Open artur-martsinkovskyi opened 5 years ago
Hi Artur,
Thanks for using tty gems!
It would be really sweet if you had time to work on fixing this bug in strings
. Also, please open an issue on tty-box
project as well.
This is really cool that you're building a console game! Are you planning to open source it? I'd like to see how you're using tty libraries and generally coding the game. I'm currently working on a console game myself, which is the reason why I've created tty-box
package!
Yes, I am going to outsource it, it is my masters degree thesis, actually. It may be a bit hard to resolve the issue with plain strings, maybe udecorated versions would fit more into the essence of the issue of printing decorated strings inside the box.
Describe the problem
This library(and the whole tty ecosystem) is awesome and I really like it, although I found a cornercase that also pollutes tty-box library of yours. I tried to use pastel colored strings inside the box and it failed with an error because it would not correctly process them. I will submit another issue and PR for tty-box on that problem. After I patched the problem with tty-box, I found that there was another problem lying in strings library. Strings that have multiple ascii color styling segments are getting trashed by Strings.wrap call, so they are displayed improperly in the box.
Why this is a valid usecase
I am using your library as a skeleton for my social simulation game-like console application. One of the parts of this application includes a console ncurses interface with a map to display current state of the world. Some of the information is better communicated to the user using color, so I'd like have an ability to color each tile independently which is now not possible.
Steps to reproduce the problem
Actual behaviour
Strings with multiple ascii color styling segments get mangled and unacceptable to use.
Expected behaviour
Strings with multiple ascii color styling segments are correctly wrapped as in the case with single segment with style encoding.
Examples
Describe your environment