fix(picker.lines): use original buf instead of current (which can be the picker on refresh)

This commit is contained in:
Folke Lemaitre 2025-02-08 17:21:03 +01:00
parent c5060a801c
commit 7ccf9c9d69
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -2,8 +2,8 @@ local M = {}
---@param opts snacks.picker.lines.Config
---@type snacks.picker.finder
function M.lines(opts)
local buf = opts.buf or 0
function M.lines(opts, ctx)
local buf = opts.buf or ctx.filter.current_buf
buf = buf == 0 and vim.api.nvim_get_current_buf() or buf
local extmarks = require("snacks.picker.util.highlight").get_highlights({ buf = buf, extmarks = true })
local lines = vim.api.nvim_buf_get_lines(buf, 0, -1, false)