1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-04-29 07:39:06 +02:00

Allow formatting codes applied later to override settings of earlier ones

This commit is contained in:
Ell 2024-03-17 21:54:06 +01:00
parent 0c5369e687
commit 23103613cd
2 changed files with 4 additions and 0 deletions

View file

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

View file

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
@ -14,6 +15,7 @@ namespace MLEM.Formatting {
/// <summary>
/// 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.
/// </summary>
public readonly Code[] AppliedCodes;
/// <summary>
@ -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;