Compare commits

..

2 Commits

Author SHA1 Message Date
Sven Balzer
4985e498e6 respect should_exit on linux as well 2025-12-06 17:02:39 +01:00
Sven Balzer
2e95908242 Fix deletion of categories to actually delete the one clicked and not the last one.
Also remove categorized days that had the deleted category.
2025-12-05 22:27:45 +01:00

View File

@ -485,6 +485,18 @@ void per_frame(){
ImGui::TableSetColumnIndex(3);
if (ImGui::Button("d")) {
for (size_t j = 0; j < num_categorized_days; j++) {
// Remove categorized days that have the to be deleted category
if (categorized_days[j].category == i) {
for (size_t k = j; k < num_categorized_days - 1; k++) categorized_days[k] = categorized_days[k + 1];
num_categorized_days--;
j--;
}
// Decrement the category index of all categorized days that have an index higher than the one to be removed
if (categorized_days[j].category > i) categorized_days[j].category--;
}
// Remove the category
for (size_t j = i; j < num_categories - 1; j++) categories[j] = categories[j + 1];
num_categories--;
}