Skip to content

Commit

Permalink
[KMS] TextRenderer: Support trim (Fix #54)
Browse files Browse the repository at this point in the history
  • Loading branch information
KENNYSOFT committed Jan 1, 2021
1 parent 8511b9b commit 269f133
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions WzComparerR2.Common/Text/TextRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private List<Run> SplitWords(Run run)
}
}
len = (i--) - start;
runs.Add(new Run(start, len) { IsWhiteSpace = true });
runs.Add(new Run(start, len) { IsWhiteSpace = true, ColorID = run.ColorID });
break;

case '\r':
Expand Down Expand Up @@ -249,8 +249,20 @@ private void DrawRuns(List<Run> runs, int width, ref int y, int lineHeight)
}
run = runs[r];
}
if (run.ColorID == colorID && run.ColorID == "" && run.Length == 1 && this.sb[run.StartIndex] == ' ')
{
end = run.StartIndex + run.Length;
if (++r >= runs.Count)
{
break;
}
run = runs[r];
}
flush(true);
start = run.StartIndex;
if (r < runs.Count)
{
start = run.StartIndex;
}
xOffset = run.X;
}
if (width - curX < run.Width)
Expand Down

0 comments on commit 269f133

Please sign in to comment.