From a5453acdc5876f42e2fb3a6d67ef3b2f8731cef8 Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Fri, 22 May 2026 10:46:29 +0800 Subject: [PATCH] Fix wrong multi-variant category displayed in unsaved cfg dialog if option name is a prefix of another option (such as `filament_wipe` and `filament_wipe_distance`) --- src/libslic3r/PrintConfig.cpp | 2 +- src/slic3r/GUI/Search.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 33294735b7..ee4d543c22 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -8257,7 +8257,7 @@ std::set filament_options_with_variant = { "filament_deretraction_speed", "filament_retraction_minimum_travel", "filament_retract_when_changing_layer", - "filament_wipe", + "filament_wipe", //BBS "filament_wipe_distance", "filament_retract_before_wipe", diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index cb77f13256..1d5cf0b9e5 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -346,14 +346,15 @@ const Option &OptionsSearcher::get_option(const std::string &opt_key, Preset::Ty if (it->opt_key() == opt_key2) { variant_index = -1; } else { - it = std::lower_bound(it, options.end(), Option({boost::nowide::widen(get_key(opt_key2 + "#", type))})); - if (it == options.end() || it->opt_key().compare(0, opt_key2.length(), opt_key2) != 0) { + const std::string opt_key3 = opt_key2 + "#"; + it = std::lower_bound(it, options.end(), Option({boost::nowide::widen(get_key(opt_key3, type))})); + if (it == options.end() || it->opt_key().compare(0, opt_key3.length(), opt_key3) != 0) { variant_index = -2; // Not found return options[0]; } auto it2 = it; ++it2; - if (it2 != options.end() && it2->opt_key().compare(0, opt_key2.length(), opt_key2) == 0 + if (it2 != options.end() && it2->opt_key().compare(0, opt_key3.length(), opt_key3) == 0 && printer_options_with_variant_1.find(opt_key2) == printer_options_with_variant_1.end()) variant_index = -2; }