aboutsummaryrefslogtreecommitdiff
path: root/core/ui.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2020-03-16 11:43:33 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2020-03-16 11:43:33 -0400
commitc8e73a92164fa17597985dd4f2d63ec2d91badd8 (patch)
treeefc2518471d2cca1e27d08511d3a9ff7b1b9a0c8 /core/ui.lua
parenta79590f80c11d9b1aa363d9fd3f96d86bcde74f1 (diff)
downloadtextadept-c8e73a92164fa17597985dd4f2d63ec2d91badd8.tar.gz
textadept-c8e73a92164fa17597985dd4f2d63ec2d91badd8.zip
Use a default width for `ui.dialogs.filteredlist` dialogs.
Experience has shown a vast majority of filteredlist dialogs need to be wide. Use a standard width that needs to be overridden rather than remembered.
Diffstat (limited to 'core/ui.lua')
-rw-r--r--core/ui.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/ui.lua b/core/ui.lua
index aec0725f..5adbc758 100644
--- a/core/ui.lua
+++ b/core/ui.lua
@@ -102,6 +102,9 @@ ui.dialogs = setmetatable({}, {__index = function(_, k)
-- @return Lua objects depending on the dialog kind
return function(options)
if not options.button1 then options.button1 = _L['OK'] end
+ if k == 'filteredlist' and not options.width then
+ options.width = ui.size[1] - 2 * (CURSES and 1 or 100)
+ end
-- Transform key-value pairs into command line arguments.
local args = {}
for option, value in pairs(options) do
@@ -220,8 +223,7 @@ function ui.switch_buffer(zorder)
utf8_list[#utf8_list + 1] = filename
end
local button, i = ui.dialogs.filteredlist{
- title = _L['Switch Buffers'], columns = columns, items = utf8_list,
- width = CURSES and ui.size[1] - 2 or nil
+ title = _L['Switch Buffers'], columns = columns, items = utf8_list
}
if button == 1 and i then
view:goto_buffer(buffers[not zorder and i or i + 1])