Skip to content

Commit 80d2467

Browse files
committed
fix(snacks): width not respected by picker config
1 parent b7fd9ef commit 80d2467

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

lua/opencode/ui/base_picker.lua

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,13 @@ local function mini_pick_ui(opts)
245245
end
246246

247247
mini_pick.start({
248-
window = opts.width and {
249-
config = {
250-
width = opts.width + 2, -- extra space for mini.pick UI
251-
},
252-
} or nil,
248+
window = opts.width
249+
and {
250+
config = {
251+
width = opts.width + 2, -- extra space for mini.pick UI
252+
},
253+
}
254+
or nil,
253255
source = {
254256
items = items,
255257
name = opts.title,
@@ -271,7 +273,16 @@ local function snacks_picker_ui(opts)
271273

272274
local snack_opts = {
273275
title = opts.title,
274-
layout = { preset = 'select', width = opts.width or nil },
276+
layout = {
277+
preset = 'select',
278+
config = function(layout)
279+
local width = opts.width and (opts.width + 3) or nil -- extra space for snacks UI
280+
layout.layout.width = width
281+
layout.layout.max_width = width
282+
layout.layout.min_width = width
283+
return layout
284+
end,
285+
},
275286
finder = function()
276287
return opts.items
277288
end,

0 commit comments

Comments
 (0)