1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 12:58:33 +01:00

Fixed TokenizedString handling trailing spaces incorrectly in the last line of non-left aligned text

This commit is contained in:
Ell 2022-09-02 13:58:12 +02:00
parent 32dad847a0
commit 0fe4c940d7
2 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -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) {