From d5baea48dd6bd30ca013b5d217a9d48c7c012219 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Mon, 23 May 2022 20:49:23 +0300 Subject: [PATCH] Fix handling empty lines at the end of ui::label --- libs/ui/source/label.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/ui/source/label.cpp b/libs/ui/source/label.cpp index 0f94c627..2137106a 100644 --- a/libs/ui/source/label.cpp +++ b/libs/ui/source/label.cpp @@ -437,7 +437,7 @@ namespace psemek::ui { std::size_t current_item = 0; - while (current_item < items.size()) + while (true) { if (skip_spaces_) { @@ -485,6 +485,9 @@ namespace psemek::ui lines.push_back({line_begin, current_item}); + if (current_item == items.size()) + break; + if (newline_end) ++current_item; }