NEW:limit the length of project name

jira:[project name]

Change-Id: I955620f7073b3b7fda280d1118524f561d047751
This commit is contained in:
tao wang 2023-12-22 16:10:15 +08:00 committed by Lane.Wei
parent 9f545fd18d
commit 594a189108
1 changed files with 8 additions and 2 deletions

View File

@ -76,9 +76,15 @@ std::string PrintJob::truncate_string(const std::string& str, size_t maxLength)
}
wxString local_str = wxString::FromUTF8(str);
wxString truncatedStr = local_str.Mid(0, maxLength - 3);
truncatedStr.append("...");
wxString truncatedStr;
for (auto i = 1; i < local_str.Length(); i++) {
wxString tagStr = local_str.Mid(0, i);
if (tagStr.ToUTF8().length() >= maxLength) {
truncatedStr = local_str.Mid(0, i - 1);
break;
}
}
return truncatedStr.utf8_string();
}