From 216ac8b98817565740e11e17874e45b2e618e189 Mon Sep 17 00:00:00 2001 From: Benau Date: Tue, 14 Sep 2021 10:21:49 +0800 Subject: [PATCH] Fix missing text if it starts with newline --- src/states_screens/online/networking_lobby.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/states_screens/online/networking_lobby.cpp b/src/states_screens/online/networking_lobby.cpp index 066e519bf..21f396a61 100644 --- a/src/states_screens/online/networking_lobby.cpp +++ b/src/states_screens/online/networking_lobby.cpp @@ -347,12 +347,20 @@ void NetworkingLobby::addMoreServerInfo(core::stringw info) gui::SF_ENABLE_CLUSTER_TEST); // Highlight addon name from /installaddon - if (cur_info.empty() || !cur_info[0].orig_string) - return; - std::shared_ptr orig_str = cur_info[0].orig_string; std::set addon_names; const std::u32string ia = U"/installaddon "; - size_t pos = orig_str->find(ia, 0); + size_t pos = 0; + std::shared_ptr orig_str; + for (gui::GlyphLayout& gl : cur_info) + { + orig_str = gl.orig_string; + if (orig_str) + break; + } + if (!orig_str) + goto break_glyph_layouts; + + pos = orig_str->find(ia, 0); while (pos != std::u32string::npos) { size_t newline_pos = orig_str->find(U'\n', pos + ia.size()); @@ -393,6 +401,7 @@ void NetworkingLobby::addMoreServerInfo(core::stringw info) } } +break_glyph_layouts: gui::IGUIFont* font = GUIEngine::getFont(); gui::breakGlyphLayouts(cur_info, box_width, font->getInverseShaping(), font->getScale());