Skip to content

Commit

Permalink
More kizer suggested optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
Infiziert90 committed Nov 18, 2024
1 parent c2dbc87 commit 61da949
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions Dalamud/Game/Gui/ChatGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
using System.Collections.Immutable;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

using Dalamud.Configuration.Internal;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Hooking;
using Dalamud.Interface.ImGuiSeStringRenderer.Internal.TextProcessing;
using Dalamud.IoC;
using Dalamud.IoC.Internal;
using Dalamud.Logging.Internal;
Expand Down Expand Up @@ -111,6 +111,8 @@ void IInternalDisposableService.DisposeService()
this.handleLinkClickHook.Dispose();
}

#region DalamudSeString

/// <inheritdoc/>
public void Print(XivChatEntry chat)
{
Expand All @@ -124,8 +126,6 @@ public void Print(XivChatEntry chat)
});
}

#region DalamudSeString

/// <inheritdoc/>
public void Print(string message, string? messageTag = null, ushort? tagColor = null)
{
Expand Down Expand Up @@ -196,16 +196,9 @@ public void UpdateQueue()
continue;
}

var text = Encoding.UTF8.GetString(payload.Body);
if (!text.Contains('\u202F'))
{
sb.Append(payload);
continue;
}

foreach (var c in text)
foreach (var c in UtfEnumerator.From(payload.Body, UtfEnumeratorFlags.Default))
{
if (c == 0x202f)
if (c.Value.IntValue == 0x202F)
sb.BeginMacro(MacroCode.NonBreakingSpace).EndMacro();
else
sb.Append(c);
Expand Down

0 comments on commit 61da949

Please sign in to comment.