1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 14:38:34 +01:00

formattedstring fixes

This commit is contained in:
Ellpeck 2019-09-06 18:10:11 +02:00
parent 6d236fa52c
commit 7d9da6c519

View file

@ -11,15 +11,16 @@ namespace MLEM.Formatting {
public string Value { public string Value {
get => this.value; get => this.value;
set { set {
if (this.value != value) { var val = value ?? string.Empty;
this.value = value; if (this.value != val) {
this.value = val;
this.isDirty = true; this.isDirty = true;
} }
} }
} }
private Dictionary<int, FormattingCode> codeLocations; private Dictionary<int, FormattingCode> codeLocations;
private string textWithoutFormatting; private string textWithoutFormatting;
private bool isDirty; private bool isDirty = true;
public FormattedString(string s = null) { public FormattedString(string s = null) {
this.Value = s; this.Value = s;
@ -32,8 +33,8 @@ namespace MLEM.Formatting {
private void CheckDirtyState() { private void CheckDirtyState() {
if (this.isDirty) { if (this.isDirty) {
this.isDirty = false; this.isDirty = false;
this.codeLocations = this.value.GetFormattingCodes(); this.codeLocations = this.Value.GetFormattingCodes();
this.textWithoutFormatting = this.value.RemoveFormatting(); this.textWithoutFormatting = this.Value.RemoveFormatting();
} }
} }