Skip to content

Commit

Permalink
Allow formatting codes applied later to override settings of earlier …
Browse files Browse the repository at this point in the history
…ones
  • Loading branch information
Ellpeck committed Mar 17, 2024
1 parent 0c5369e commit 2310361
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions MLEM/Formatting/Token.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
Expand All @@ -14,6 +15,7 @@ public class Token : GenericDataHolder {

/// <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>
Expand Down Expand Up @@ -45,6 +47,7 @@ public class Token : GenericDataHolder {
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;
Expand Down

0 comments on commit 2310361

Please sign in to comment.