From 497dedb930446e3c2af0b9ae7f918084b4cf78e6 Mon Sep 17 00:00:00 2001 From: sch-lda <54973190+sch-lda@users.noreply.github.com> Date: Tue, 9 Jul 2024 23:23:59 +0800 Subject: [PATCH] fix(Notification): some languages don't make use of spaces(#3316) --- src/views/core/view_notifications.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/views/core/view_notifications.cpp b/src/views/core/view_notifications.cpp index 11b3b27b..ff61b223 100644 --- a/src/views/core/view_notifications.cpp +++ b/src/views/core/view_notifications.cpp @@ -21,7 +21,7 @@ namespace big fadeEnd.Value.w *= alpha; int j = 0; - int prevSpace = 0; + int prevSpace = -1; float total_size = 0.f; std::vector split_points; @@ -43,10 +43,19 @@ namespace big } else if (size.x >= 330.f) { - total_size = total_size + size.y; - split_points.push_back(message.substr(j, prevSpace - j)); - j = prevSpace + 1; - i = prevSpace; + if (prevSpace != -1) + { + total_size = total_size + size.y; + split_points.push_back(message.substr(j, prevSpace - j)); + j = prevSpace + 1; + i = prevSpace; + } + else + { + total_size = total_size + size.y; + split_points.push_back(message.substr(j, i - j)); + j = i; + } } }