File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2587,12 +2587,15 @@ void CBaseHudChatEntry::InsertChar(wchar_t ch)
25872587 return ;
25882588 }
25892589
2590+ /* Pasting strings that overflow and end with multibyte+singlebyte will truncate unintuitively ("...ABC?!!" -> "...AB?")
25902591 // Edge case: check if current wchar_t will cause Send to truncate message
25912592 int iCharByteLen; // utf-8
25922593 if ( ch < 0x80 ) iCharByteLen = 1;
25932594 else if ( ch < 0x800 ) iCharByteLen = 2;
25942595 else if ( ch >= 0xD800 && ch <= 0xDBFF ) iCharByteLen = 4; // high surrogate, assume pair
25952596 else if ( ch >= 0xDC00 && ch <= 0xDFFF ) // low surrogate
2597+ */
2598+ if ( ch >= 0xDC00 && ch <= 0xDFFF ) // low surrogate
25962599 {
25972600 // Check if previous wchar was a high surrogate
25982601 wchar_t wszHigh[2 ];
@@ -2601,13 +2604,15 @@ void CBaseHudChatEntry::InsertChar(wchar_t ch)
26012604 if ( wszHigh[0 ] >= 0xD800 && wszHigh[0 ] <= 0xDBFF ) { BaseClass::InsertChar (ch); return ; }
26022605 else return ; // it was not a hight surrogate, reject
26032606 }
2607+ /*
26042608 else iCharByteLen = 3;
26052609
26062610 if ( iCurrentByteLen + iCharByteLen <= m_iMaxByteCount )
26072611 {
26082612 BaseClass::InsertChar(ch);
26092613 return;
26102614 }
2615+ */
26112616
26122617 return ; // do not insert anything
26132618}
You can’t perform that action at this time.
0 commit comments