#### Brief overview of PR changes/additions
Fixes text containing `<` characters being swallowed when connecting to
games that negotiate MXP via telnet but don't actually send MXP content.
The fix validates text against the MXP specification to distinguish real
MXP tags from regular text, preventing false positives when `<` appears
in normal game text.
#### Motivation for adding to Mudlet
Users reported that typing commands like `echo <test` resulted in no
output on certain games (e.g., Merentha). The `<` character was being
interpreted as the start of an MXP tag, causing text to disappear.
#### Other info (issues closed, discussion etc)
Fixes#8899, #8980
<!-- Keep the title short & concise so anyone non-technical can
understand it,
the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Reduce Mudlet build times
#### Motivation for adding to Mudlet
Address #6765, and give developers a better experience.
#### Other info (issues closed, discussion etc)
Benchmark Results
=== Testing: development (before) (development) ===
Run 1 of 3...
Time: 226.071397436s
Run 2 of 3...
Time: 216.059263209s
Run 3 of 3...
Time: 221.592760908s
=== Testing: PR #8403 (after) (pr-8403) ===
Run 1 of 3...
Time: 191.112400957s
Run 2 of 3...
Time: 193.975717783s
Run 3 of 3...
Time: 196.569316252s
[benchmark-mudlet-build.sh](https://github.com/user-attachments/files/24466717/benchmark-mudlet-build.sh)
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Vadim Peretokin <vadi2@users.noreply.github.com>
<!-- Keep the title short & concise so anyone non-technical can
understand it,
the title appears in PTB changelogs -->
### Motivation for adding to Mudlet
This pull request addresses issue #7896.
#### Problem re-explained
Currently if the MUD game sends a non-escaped "&" or "<" the MXP parser
will consider what follows as a "tag" or an "entity" and therefore will
not display it on the screen.
```
MUD sends -> "Greetings heroes & villains\n"
Mudlet displays -> "Greetings heroes"
```
Sometimes it would even freeze.
This behavior usually results from the MUD game not escaping characters
properly.
### Brief overview of PR changes/additions
1) If an entity (something that starts with '&') has non legal
characters (spaces or newline for example), immediately display the text
as raw text.
```
"Heroes & Villains\n" (a space is following the '&' -> malformed entity detected)
```
2) If a tag (something that starts with '<') is never closed after
3seconds, display the text that follows as raw text.
3) While looking for a closing '>' if the parser encounters another '<',
consider the first '<' as malformed and immediately display the text as
raw text.
```
MUD sends -> "Enemies < Your hero <!EN validTag \"sword\">\n"
Mudlet displays -> "Enemies < Your hero"
```
#### Tests
Additions 1. and 3. have unit tests.
Addition 2 (the change in TBuffer::translateToPlainText()) currently
requires one of the following :
either a manual test :
```
void TMainConsole::printOnDisplay(std::string& incomingSocketData, const bool isFromServer)
{
Q_ASSERT_X(mpLineEdit_networkLatency, "TMainConsole::printOnDisplay(...)", "mpLineEdit_networkLatency does not point to a valid QLineEdit");
mProcessingTimer.restart();
// Add this snippet
static bool mxpPrefixAlreadySent = false;
if (mpHost->mTelnet.isMXPEnabled() && !mxpPrefixAlreadySent) {
mxpPrefixAlreadySent = true;
incomingSocketData = "heroes < villains" + incomingSocketData;
}
```
or
a test that would use a newly created stub of the class TBuffer
(which is currently too dependent on Host* and TConsole*)
or
a functional test (would need to modify the CMakeLists to create a big
static lib and link it to the test)
#### Contact
@SpyNight on discord or
nicolaskeita2@gmail.com
/claim #7896Fixes#7896