configdialog: keep original options intact (#12093)

reviewable/pr12104/r1
hius07 3 months ago committed by GitHub
parent 48c41fccee
commit 0ae84642e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -546,10 +546,14 @@ function ConfigOption:init()
local row_count = self.options[c].row_count or 1
local toggle_height = Screen:scaleBySize(self.options[c].height
or (30 * row_count))
local toggle, args = {}, {} -- keep options intact
for i = 1, #self.options[c].toggle do
toggle[i] = self.options[c].toggle[i]
args[i] = self.options[c].args[i]
end
if self.options[c].more_options then
table.insert(self.options[c].toggle, "")
table.insert(self.options[c].args, "")
self.options[c].more_options = false
table.insert(toggle, "")
table.insert(args, "")
end
local switch = ToggleSwitch:new{
width = math.min(max_toggle_width, toggle_width),
@ -558,17 +562,17 @@ function ConfigOption:init()
font_size = item_font_size,
name = self.options[c].name,
name_text = name_text,
toggle = self.options[c].toggle,
toggle = toggle,
alternate = self.options[c].alternate,
values = self.options[c].values,
args = self.options[c].args,
args = args,
event = self.options[c].event,
hide_on_apply = self.options[c].hide_on_apply,
config = self.config,
enabled = enabled,
row_count = row_count,
callback = function(arg)
if self.options[c].toggle[arg] == "" then
if toggle[arg] == "" then
if self.options[c].show_true_value_func and not self.options[c].more_options_param.show_true_value_func then
self.options[c].more_options_param.show_true_value_func = self.options[c].show_true_value_func
end

Loading…
Cancel
Save