mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 10:45:37 +08:00
[XSwiftBus] Fixed UTF-8 ellipsis character indicating wrapped text messages.
This commit is contained in:
@@ -52,13 +52,11 @@ namespace XSwiftBus
|
|||||||
void CService::addTextMessage(const std::string &text, double red, double green, double blue)
|
void CService::addTextMessage(const std::string &text, double red, double green, double blue)
|
||||||
{
|
{
|
||||||
if (text.empty()) { return; }
|
if (text.empty()) { return; }
|
||||||
static const std::string ellipsis = "...";
|
static const std::string ellipsis = u8"\u2026";
|
||||||
const int lineLength = static_cast<int>(m_messages.maxLineLength() - ellipsis.size());
|
const int lineLength = static_cast<int>(m_messages.maxLineLength() - ellipsis.size());
|
||||||
std::vector<std::string> wrappedLines;
|
std::vector<std::string> wrappedLines;
|
||||||
for (size_t i = 0; i < text.size(); i += lineLength)
|
for (size_t i = 0; i < text.size(); i += lineLength)
|
||||||
{
|
{
|
||||||
// static const QChar ellipsis = 0x2026;
|
|
||||||
// wrappedLines.push_back(QString::fromStdString(text).mid(i, lineLength) + ellipsis);
|
|
||||||
wrappedLines.push_back(text.substr(i, lineLength) + ellipsis);
|
wrappedLines.push_back(text.substr(i, lineLength) + ellipsis);
|
||||||
}
|
}
|
||||||
wrappedLines.back().erase(wrappedLines.back().size() - 3);
|
wrappedLines.back().erase(wrappedLines.back().size() - 3);
|
||||||
|
|||||||
Reference in New Issue
Block a user