1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-15 13:48:46 +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 - Stopped the text formatter throwing if a color can't be parsed
- Improved text formatter tokenization performance - Improved text formatter tokenization performance
- Allow using control and arrow keys to move the visible area of a text input - 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 Fixes
- Fixed TextInput not working correctly when using surrogate pairs - Fixed TextInput not working correctly when using surrogate pairs

View file

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
@ -14,6 +15,7 @@ namespace MLEM.Formatting {
/// <summary> /// <summary>
/// The formatting codes that are applied on this token. /// 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> /// </summary>
public readonly Code[] AppliedCodes; public readonly Code[] AppliedCodes;
/// <summary> /// <summary>
@ -45,6 +47,7 @@ namespace MLEM.Formatting {
internal float[] InnerOffsets; internal float[] InnerOffsets;
internal Token(Code[] appliedCodes, int index, int rawIndex, string substring, string rawSubstring) { internal Token(Code[] appliedCodes, int index, int rawIndex, string substring, string rawSubstring) {
Array.Reverse(appliedCodes);
this.AppliedCodes = appliedCodes; this.AppliedCodes = appliedCodes;
this.Index = index; this.Index = index;
this.RawIndex = rawIndex; this.RawIndex = rawIndex;