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

Fix FlxText applyMarkup for markers with length > 1. #1908

Merged
merged 1 commit into from
Aug 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions flixel/text/FlxText.hx
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,13 @@ class FlxText extends FlxSprite
if (rule.marker != null && rule.format != null)
{
var start:Bool = false;
var markerLength:Int = Utf8.length(rule.marker);
if (input.indexOf(rule.marker) != -1) //if this marker is present
{
for (charIndex in 0...Utf8.length(input)) //inspect each character
{
var charCode = Utf8.charCodeAt(input, charIndex);
if (charCode == rule.marker.charCodeAt(0)) //it's one of the markers
if (Utf8.compare(Utf8.sub(input, charIndex, markerLength), rule.marker) == 0) //it's one of the markers
{
if (!start) //we're outside of a format block
{
Expand Down Expand Up @@ -344,7 +345,7 @@ class FlxText extends FlxSprite
//Consider each range start
var delIndex:Int = rangeStarts[i];

var markerLength:Int = rulesToApply[i].marker.length;
var markerLength:Int = Utf8.length(rulesToApply[i].marker);

//Any start or end index that is HIGHER than this must be subtracted by one markerLength
for (j in 0...rangeStarts.length)
Expand Down