feat(previewer): show unwritten buffer previewers for some pickers

Use actual buffer contents for buffer previewers for some pickers
(buffers, treesitter, current_buffer_fuzzy_find, for starters). Not
to be confused with reusing buffers for preview buffers.

This lets users view previews of buffers with unwritten changes. For
treesitter and current_buffer_fuzzy_find, not showing actual buffer
content is arguably a bug considering the finder operates over the
buffer (written or not). So there are instances where you can search
over unwritten content in the buffer only to see an outdated, written
only content in the preview.
This commit is contained in:
James Trew
2024-07-24 20:29:25 -04:00
parent bc4e7e4503
commit 2768d5e921
2 changed files with 131 additions and 47 deletions
+2
View File
@@ -708,6 +708,7 @@ function make_entry.gen_from_treesitter(opts)
node_text = node_text,
filename = get_filename(bufnr),
bufnr = opts.bufnr,
-- need to add one since the previewer substacts one
lnum = start_row + 1,
col = start_col,
@@ -971,6 +972,7 @@ function make_entry.gen_from_buffer_lines(opts)
ordinal = entry.text,
display = make_display,
filename = entry.filename,
bufnr = opts.bufnr,
lnum = entry.lnum,
text = entry.text,
}, opts)