Bug 799021 - Saved report renders default of gnc-register-list-option

save_scm_value was trying too hard to handle the different possible
types that Scheme can set options to and in the process converting
lists to single symobls (e.g. ('good 'ugly) became #{good ugly}#.
That not being one of the possible values it was ignored and the
default value was used.
This commit is contained in:
John Ralls
2023-07-20 14:14:50 -07:00
parent 7e0c87aab4
commit 2e76d2f43d

View File

@@ -1287,29 +1287,9 @@ inline SCM return_scm_value(ValueType value)
if constexpr (is_same_decayed_v<decltype(option),
GncOptionMultichoiceValue>)
{
auto serial{option.serialize()};
if (serial.empty())
{
return scm_simple_format(SCM_BOOL_F, list_format_str,
scm_list_1(no_value));
}
else
{
auto keytype{option.get_keytype(option.get_index())};
auto scm_str{scm_from_utf8_string(serial.c_str())};
switch (keytype)
{
case GncOptionMultichoiceKeyType::SYMBOL:
return scm_simple_format(SCM_BOOL_F, list_format_str,
scm_list_1(scm_string_to_symbol(scm_str)));
case GncOptionMultichoiceKeyType::STRING:
return scm_simple_format(SCM_BOOL_F, list_format_str,
scm_list_1((scm_str)));
case GncOptionMultichoiceKeyType::NUMBER:
return scm_simple_format(SCM_BOOL_F, ticked_format_str,
scm_list_1(scm_str));
}
}
auto scm_val{get_scm_value(option)};
return scm_simple_format(SCM_BOOL_F, list_format_str,
scm_list_1(scm_val));
}
if constexpr (is_same_decayed_v<decltype(option),
GncOptionRangeValue<int>> ||