aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCerapter <cerap@protonmail.com>2019-05-10 20:49:59 +0200
committerCerapter <cerap@protonmail.com>2019-05-10 20:49:59 +0200
commitc8a4f69d144d4be59a1fd07151579d923bcc8a6e (patch)
tree8c4ee7cdb2a423410a7c2f1af17b90e91116d4d4
parent2e4f0117b067c6d795a7d42fe23162d41260ff74 (diff)
Fix escaped HTML characters fucking up the grapheme cluster sizes.
-rw-r--r--src/courtroom.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index c313a981..ce82f884 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -2053,6 +2053,7 @@ void Courtroom::chat_tick()
{
QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_message);
QString f_character;
+ int f_char_length;
tbf.toNextBoundary();
@@ -2061,8 +2062,10 @@ void Courtroom::chat_tick()
else
f_character = f_message.left(tbf.position());
+ f_char_length = f_character.length();
f_character = f_character.toHtmlEscaped();
+
if (f_character == " ")
ui_vp_message->insertPlainText(" ");
@@ -2155,7 +2158,7 @@ void Courtroom::chat_tick()
else
{
next_character_is_not_special = true;
- tick_pos--;
+ tick_pos -= f_char_length;
}
}
@@ -2176,7 +2179,7 @@ void Courtroom::chat_tick()
else
{
next_character_is_not_special = true;
- tick_pos--;
+ tick_pos -= f_char_length;
}
}
@@ -2287,7 +2290,7 @@ void Courtroom::chat_tick()
++blip_pos;
}
- tick_pos += f_character.length();
+ tick_pos += f_char_length;
// Restart the timer, but according to the newly set speeds, if there were any.
// Keep the speed at bay.