diff options
author | jgmdev <jgmdev@gmail.com> | 2022-05-24 15:11:49 -0400 |
---|---|---|
committer | jgmdev <jgmdev@gmail.com> | 2022-05-24 15:11:49 -0400 |
commit | 52092cc5d7c04ec32d89b1e398deaa11aeb145a3 (patch) | |
tree | 410fbe8e540f59db66785ea3339fb58d210c511b | |
parent | 8c9682f38a730d076b5227a809a333c97caf54d3 (diff) | |
download | lite-xl-plugins-52092cc5d7c04ec32d89b1e398deaa11aeb145a3.tar.gz lite-xl-plugins-52092cc5d7c04ec32d89b1e398deaa11aeb145a3.zip |
settings: allow empty descriptions with default value
-rw-r--r-- | plugins/settings.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/settings.lua b/plugins/settings.lua index 74e5473..9186d84 100644 --- a/plugins/settings.lua +++ b/plugins/settings.lua @@ -893,7 +893,7 @@ local function add_control(pane, option, plugin_name) ---@type widget.label Label(pane, option.label .. ":") ---@type widget.textbox - local string = TextBox(pane, option_value) + local string = TextBox(pane, option_value or "") widget = string found = true @@ -966,14 +966,18 @@ local function add_control(pane, option, plugin_name) end end - if option.description and found then + if (option.description or option.default) and found then + local text = option.description or "" local default = "" local default_type = type(option.default) if default_type ~= "table" and default_type ~= "nil" then - default = string.format(" (default: %s)", option.default) + if text ~= "" then + text = text .. " " + end + default = string.format("(default: %s)", option.default) end ---@type widget.label - local description = Label(pane, option.description .. default) + local description = Label(pane, text .. default) description.desc = true end end |