Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lua/opencode/ui/base_picker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,17 @@ local function fzf_ui(opts)
local fzf_config = create_fzf_config()
fzf_config.actions = actions_config

-- When a preview pane is active, fzf-lua splits the window (default
-- right:60% preview, left:40% list). Narrow opts.width so that the
-- format function produces entries sized for the list pane, not the
-- full window. The format closure reads opts.width on each call.
local has_preview = opts.preview and opts.preview ~= 'none' and opts.preview ~= false
if has_preview and opts.width then
local window_cols = opts.width + 8
-- list pane ≈ 40% of the window, minus a small border/padding allowance
opts.width = math.floor(window_cols * 0.4) - 4
end

fzf_lua.fzf_exec(create_finder(), fzf_config)
end

Expand Down
13 changes: 9 additions & 4 deletions lua/opencode/ui/session_picker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ end
---@param session Session object
---@return PickerItem
function format_session_item(session, width)
local debug_text = 'ID: ' .. (session.id or 'N/A')
local updated_time = (session.time and session.time.updated) or 'N/A'
return base_picker.create_time_picker_item(session.title, updated_time, debug_text, width)
return base_picker.create_time_picker_item(session.title, updated_time, nil, width)
end

--- Normalize message order to oldest-first (chronological)
Expand Down Expand Up @@ -195,10 +194,16 @@ local function render_preview_buffer(target, formatted)
pcall(vim.api.nvim_buf_clear_namespace, bufnr, output_window.namespace, 0, -1)
output_window.apply_extmarks(bufnr, formatted.extmarks)

-- Apply folds (window-local operation)
target:with_window(function()
-- Configure preview window to match the main output window's gutter.
-- The formatter places vertical border extmarks at virt_text_win_col = -3
-- which requires a 3-column gutter (signcolumn=yes + foldcolumn=1) so
-- the border renders in the gutter instead of overlaying column 0 of text.
target:with_window(function()
vim.api.nvim_set_option_value('number', false, { win = 0 })
vim.api.nvim_set_option_value('relativenumber', false, { win = 0 })
vim.api.nvim_set_option_value('signcolumn', 'yes', { win = 0 })
vim.api.nvim_set_option_value('foldcolumn', '1', { win = 0 })
vim.api.nvim_set_option_value('statuscolumn', '', { win = 0 })
vim.api.nvim_set_option_value('foldmethod', 'manual', { win = 0 })
vim.cmd('silent! normal! zE') -- clear existing manual folds
local line_count = vim.api.nvim_buf_line_count(bufnr)
Expand Down
Loading