Skip to content

Commit

Permalink
fix(search_headings): always get new bufnr
Browse files Browse the repository at this point in the history
  • Loading branch information
max397574 committed Feb 13, 2023
1 parent b77dfdc commit 0aff25f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lua/telescope/_extensions/neorg/search_headings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ local neorg_loaded, _ = pcall(require, "neorg.modules")

assert(neorg_loaded, "Neorg is not loaded - please make sure to load Neorg first")

local bufnr = vim.api.nvim_get_current_buf()

local filename = vim.fn.expand(vim.api.nvim_buf_get_name(bufnr))
local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype")

return function(options)
local bufnr = vim.api.nvim_get_current_buf()
local filename = vim.fn.expand(vim.api.nvim_buf_get_name(bufnr))
local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype")
local opts = options
or themes.get_dropdown({
border = true,
Expand Down Expand Up @@ -68,9 +66,8 @@ return function(options)

-- update to changes on Neovim master, see https://github.com/neovim/neovim/pull/19931
-- TODO(max): remove when dropping support for Neovim 0.7
local on_nvim_master = vim.fn.has("nvim-0.8") == 1
for id, node in query:iter_captures(root, opts.bufnr, 0, -1) do
local hl = on_nvim_master and query.captures[id] or highlighter_query:_get_hl_from_capture(id)
local hl = query.captures[id]
if hl and type(hl) ~= "number" then
local row1, col1, row2, col2 = node:range()

Expand Down

0 comments on commit 0aff25f

Please sign in to comment.