Skip to content

Commit 2e52aad

Browse files
committed
fix: respect user's default snacks picker layout preset
Previously base_picker hardcoded the layout preset to 'default' or 'select' based on whether preview was enabled. This meant user-configured presets (ivy/telescope/default/select) were not respected for non-file pickers. Remove the hardcoded preset to let Snacks use the user's default preference, matching the behavior of the file picker.
1 parent b575131 commit 2e52aad

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lua/opencode/ui/base_picker.lua

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ local function fzf_ui(opts)
230230
return function(fzf_cb)
231231
for _, item in ipairs(opts.items) do
232232
local line_str = opts.format_fn(item):to_string()
233-
233+
234234
-- For file preview support, append file:line:col format
235235
-- fzf-lua's builtin previewer automatically parses this format
236236
if opts.preview == 'file' and type(item) == 'table' then
237237
local file_path = item.file_path or item.path or item.filename or item.file
238238
local line = item.line or item.lnum
239239
local col = item.column or item.col
240-
240+
241241
if file_path then
242242
-- fzf-lua parses "path:line:col:" format for preview positioning
243243
local pos_info = file_path
@@ -254,7 +254,7 @@ local function fzf_ui(opts)
254254
line_str = line_str .. nbsp .. pos_info
255255
end
256256
end
257-
257+
258258
fzf_cb(line_str)
259259
end
260260
fzf_cb()
@@ -392,21 +392,17 @@ local function snacks_picker_ui(opts)
392392
-- Determine if preview is enabled
393393
local has_preview = opts.preview == 'file'
394394

395-
-- Choose layout preset based on preview
396-
local layout_preset = has_preview and 'default' or 'select'
397-
395+
---@type snacks.picker.Config
398396
local snack_opts = {
399-
title = opts.title,
397+
title = type(opts.title) == 'function' and opts.title() or opts.title,
400398
layout = {
401-
preset = layout_preset,
402399
config = function(layout)
403400
local width = opts.width and (opts.width + 3) or nil -- extra space for snacks UI
404401
if not has_preview then
405402
layout.layout.width = width
406403
layout.layout.max_width = width
407404
layout.layout.min_width = width
408405
end
409-
return layout
410406
end,
411407
},
412408
finder = function()

0 commit comments

Comments
 (0)