mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-07 00:58:39 +02:00
Battle console: attempt to re-split string if it is too long to fit into
two lines due to line break
This commit is contained in:
@ -83,6 +83,13 @@ std::vector<std::string> BattleConsole::getVisibleText()
|
|||||||
|
|
||||||
auto result = CMessage::breakText(text, pos.w, FONT_SMALL);
|
auto result = CMessage::breakText(text, pos.w, FONT_SMALL);
|
||||||
|
|
||||||
|
if(result.size() > 2 && text.find('\n') != std::string::npos)
|
||||||
|
{
|
||||||
|
// Text has too many lines to fit into console, but has line breaks. Try ignore them and fit text that way
|
||||||
|
std::string cleanText = boost::algorithm::replace_all_copy(text, "\n", " ");
|
||||||
|
result = CMessage::breakText(cleanText, pos.w, FONT_SMALL);
|
||||||
|
}
|
||||||
|
|
||||||
if(result.size() > 2)
|
if(result.size() > 2)
|
||||||
result.resize(2);
|
result.resize(2);
|
||||||
return result;
|
return result;
|
||||||
|
Reference in New Issue
Block a user