2026-04-15 08:24:06 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
2026-04-15 23:13:09 +08:00
|
|
|
namespace XCEngine::UI::Editor::App::Internal {
|
2026-04-15 08:24:06 +08:00
|
|
|
|
|
|
|
|
inline std::string TruncateText(const std::string& text, std::size_t maxLength) {
|
|
|
|
|
if (text.size() <= maxLength) {
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (maxLength <= 3u) {
|
|
|
|
|
return text.substr(0u, maxLength);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return text.substr(0u, maxLength - 3u) + "...";
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-15 23:13:09 +08:00
|
|
|
} // namespace XCEngine::UI::Editor::App::Internal
|