1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-28 07:18:35 +01:00

Compare commits

..

No commits in common. "23103613cddeaf151f211640e9e5d1e69f99d627" and "62ef75441a75c05b872398ffdac4ab81adba6a0d" have entirely different histories.

4 changed files with 1 additions and 12 deletions

View file

@ -26,13 +26,11 @@ 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
- Fixed InputHandler touch states being initialized incorrectly when touch handling is disabled - Fixed InputHandler touch states being initialized incorrectly when touch handling is disabled
- Fixed empty NinePatch regions stalling when using tile mode - Fixed empty NinePatch regions stalling when using tile mode
- Fixed bold and italic formatting code closing tags working on each other
### MLEM.Ui ### MLEM.Ui
Additions Additions

View file

@ -15,7 +15,7 @@ namespace Demos {
private const string Text = private const string Text =
"MLEM's text formatting system allows for various <b>formatting codes</b> to be applied in the middle of a string. Here's a demonstration of some of them.\n\n" + "MLEM's text formatting system allows for various <b>formatting codes</b> to be applied in the middle of a string. Here's a demonstration of some of them.\n\n" +
"You can write in <b>bold</b>, <i>italics</i>, <u>with an underline</u>, <st>strikethrough</st>, with a <s>drop shadow</s> whose <s #ff0000 4>color</s> and <s #000000 10>offset</s> you can modify in each application of the code, with an <o>outline</o> that you can also <o #ff0000 4>modify</o> <o #ff00ff 2>dynamically</o>, or with various types of <b>combined <c Pink>formatting</c> codes</b>.\n\n" + "You can write in <b>bold</i>, <i>italics</i>, <u>with an underline</u>, <st>strikethrough</st>, with a <s>drop shadow</s> whose <s #ff0000 4>color</s> and <s #000000 10>offset</s> you can modify in each application of the code, with an <o>outline</o> that you can also <o #ff0000 4>modify</o> <o #ff00ff 2>dynamically</o>, or with various types of <b>combined <c Pink>formatting</c> codes</b>.\n\n" +
"You can apply <c CornflowerBlue>custom</c> <c Yellow>colors</c> to text, including all default <c Orange>MonoGame colors</c> and <c #aabb00>inline custom colors</c>.\n\n" + "You can apply <c CornflowerBlue>custom</c> <c Yellow>colors</c> to text, including all default <c Orange>MonoGame colors</c> and <c #aabb00>inline custom colors</c>.\n\n" +
"You can also use animations like <a wobbly>a wobbly one</a>, as well as create custom ones using the <a wobbly>Code class</a>.\n\n" + "You can also use animations like <a wobbly>a wobbly one</a>, as well as create custom ones using the <a wobbly>Code class</a>.\n\n" +
"You can also display <i grass> icons in your text, and use super<sup>script</sup> or sub<sub>script</sub> formatting!\n\n" + "You can also display <i grass> icons in your text, and use super<sup>script</sup> or sub<sub>script</sub> formatting!\n\n" +

View file

@ -18,11 +18,5 @@ namespace MLEM.Formatting.Codes {
return this.font?.Invoke(defaultPick); return this.font?.Invoke(defaultPick);
} }
/// <inheritdoc />
public override bool EndsHere(Code other) {
// turning a string bold/italic should only end when that specific code is ended using SimpleEndCode
return false;
}
} }
} }

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
@ -15,7 +14,6 @@ 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>
@ -47,7 +45,6 @@ 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;