refactor(new_editor/app): reorganize host structure and add smoke test
This commit is contained in:
19
new_editor/app/Support/TextFormat.h
Normal file
19
new_editor/app/Support/TextFormat.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace XCEngine::UI::Editor::Support {
|
||||
|
||||
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) + "...";
|
||||
}
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Support
|
||||
Reference in New Issue
Block a user