diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e0887e..a78190d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ Improvements - Improved EnumHelper.GetValues signature to return an array - Allow using external gesture handling alongside InputHandler through ExternalGestureHandling +Fixes +- Fixed TokenizedString handling trailing spaces incorrectly in the last line of non-left aligned text + ### MLEM.Ui Additions - Added some extension methods for querying Anchor types diff --git a/MLEM/Formatting/TokenizedString.cs b/MLEM/Formatting/TokenizedString.cs index dd437e0..22c747d 100644 --- a/MLEM/Formatting/TokenizedString.cs +++ b/MLEM/Formatting/TokenizedString.cs @@ -223,7 +223,7 @@ namespace MLEM.Formatting { var token = this.Tokens[tokenIndex]; var tokenFont = token.GetFont(defaultFont); // if we're the last line in our line array, then we don't contain a line split, so the line ends in a later token - var endsLater = lineIndex >= token.SplitDisplayString.Length - 1; + var endsLater = lineIndex >= token.SplitDisplayString.Length - 1 && tokenIndex < this.Tokens.Length - 1; // if the line ends in our token, we should ignore trailing white space var restOfLine = tokenFont.MeasureString(token.SplitDisplayString[lineIndex], !endsLater).X; if (endsLater) {