mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/LCE-Revelations.git
synced 2026-05-24 10:44:50 +00:00
Fix broken Chat Formatting behavior (#1520)
- Remove shadowcolor from font tags (Iggy doesn't support multiple) - Enforce HTML text mode on chat labels and jukebox - Move IDS translatable pattern matching into FormatChatMessage - Add §r (reset) color code support - Fix message truncation to count visible characters, skipping HTML tags - Fix CJK truncation using raw index instead of visible char count
This commit is contained in:
@@ -66,7 +66,6 @@
|
||||
#include "../Minecraft.World/DurangoStats.h"
|
||||
#include "../Minecraft.World/GenericStats.h"
|
||||
#endif
|
||||
#include <regex>
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -1608,8 +1607,6 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
|
||||
bool replaceEntitySource = false;
|
||||
bool replaceItem = false;
|
||||
|
||||
static std::wregex IDS_Pattern(LR"(\{\*IDS_(\d+)\*\})"); //maybe theres a better way to do translateable IDS
|
||||
|
||||
int stringArgsSize = packet->m_stringArgs.size();
|
||||
|
||||
wstring playerDisplayName = L"";
|
||||
@@ -1626,15 +1623,10 @@ void ClientConnection::handleChat(shared_ptr<ChatPacket> packet)
|
||||
if (stringArgsSize >= 1) {
|
||||
message = packet->m_stringArgs[0];
|
||||
|
||||
std::wsmatch match;
|
||||
while (std::regex_search(message, match, IDS_Pattern)) {
|
||||
message = replaceAll(message, match[0], app.GetString(std::stoi(match[1].str())));
|
||||
}
|
||||
|
||||
message = app.EscapeHTMLString(message); //do this to enforce escaped string
|
||||
message = app.FormatChatMessage(message); //this needs to be last cause it converts colors to html colors that would have been escaped
|
||||
} else {
|
||||
message = L"empty message";
|
||||
message = L"";
|
||||
}
|
||||
displayOnGui = (packet->m_messageType == ChatPacket::e_ChatCustom);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user