diff --git a/CHANGELOG.md b/CHANGELOG.md index 5be01fd..a8aa02d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ Improvements - Stopped the text formatter throwing if a color can't be parsed - Improved text formatter tokenization performance - Allow using control and arrow keys to move the visible area of a text input +- Allow formatting codes applied later to override settings of earlier ones Fixes - Fixed TextInput not working correctly when using surrogate pairs diff --git a/MLEM/Formatting/Token.cs b/MLEM/Formatting/Token.cs index 6280351..518f466 100644 --- a/MLEM/Formatting/Token.cs +++ b/MLEM/Formatting/Token.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; @@ -14,6 +15,7 @@ namespace MLEM.Formatting { /// /// The formatting codes that are applied on this token. + /// Codes are stored application order, with the first entry in the array being the code that was most recently applied. /// public readonly Code[] AppliedCodes; /// @@ -45,6 +47,7 @@ namespace MLEM.Formatting { internal float[] InnerOffsets; internal Token(Code[] appliedCodes, int index, int rawIndex, string substring, string rawSubstring) { + Array.Reverse(appliedCodes); this.AppliedCodes = appliedCodes; this.Index = index; this.RawIndex = rawIndex;