mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-30 08:57:00 +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:
parent
1f1e693a5b
commit
85d8e093df
@ -83,6 +83,13 @@ std::vector<std::string> BattleConsole::getVisibleText()
|
||||
|
||||
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)
|
||||
result.resize(2);
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user