aboutsummaryrefslogtreecommitdiff
path: root/plugins/settings.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-05-24 15:11:49 -0400
committerjgmdev <jgmdev@gmail.com>2022-05-24 15:11:49 -0400
commit52092cc5d7c04ec32d89b1e398deaa11aeb145a3 (patch)
tree410fbe8e540f59db66785ea3339fb58d210c511b /plugins/settings.lua
parent8c9682f38a730d076b5227a809a333c97caf54d3 (diff)
downloadlite-xl-plugins-52092cc5d7c04ec32d89b1e398deaa11aeb145a3.tar.gz
lite-xl-plugins-52092cc5d7c04ec32d89b1e398deaa11aeb145a3.zip
settings: allow empty descriptions with default value
Diffstat (limited to 'plugins/settings.lua')
-rw-r--r--plugins/settings.lua12
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