mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Replace U+202F with Indent payload (#1761)
* Replace U+202F with Indent payload * comment --------- Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
This commit is contained in:
parent
84abd23ad5
commit
c8f65e24f0
1 changed files with 41 additions and 21 deletions
|
|
@ -155,9 +155,29 @@ internal sealed unsafe class ChatGui : IInternalDisposableService, IChatGui
|
|||
while (this.chatQueue.Count > 0)
|
||||
{
|
||||
var chat = this.chatQueue.Dequeue();
|
||||
var replacedMessage = new SeStringBuilder();
|
||||
|
||||
// Normalize Unicode NBSP to the built-in one, as the former won't renderl
|
||||
foreach (var payload in chat.Message.Payloads)
|
||||
{
|
||||
if (payload is TextPayload { Text: not null } textPayload)
|
||||
{
|
||||
var split = textPayload.Text.Split("\u202f"); // NARROW NO-BREAK SPACE
|
||||
for (var i = 0; i < split.Length; i++)
|
||||
{
|
||||
replacedMessage.AddText(split[i]);
|
||||
if (i + 1 < split.Length)
|
||||
replacedMessage.Add(new RawPayload([0x02, (byte)Lumina.Text.Payloads.PayloadType.Indent, 0x01, 0x03]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
replacedMessage.Add(payload);
|
||||
}
|
||||
}
|
||||
|
||||
var sender = Utf8String.FromSequence(chat.Name.Encode());
|
||||
var message = Utf8String.FromSequence(chat.Message.Encode());
|
||||
var message = Utf8String.FromSequence(replacedMessage.BuiltString.Encode());
|
||||
|
||||
this.HandlePrintMessageDetour(RaptureLogModule.Instance(), chat.Type, sender, message, (int)chat.SenderId, (byte)(chat.Parameters != 0 ? 1 : 0));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue