telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

Builtin buffer picker highlights flags column when searching

Open bedlamzd opened this issue 6 months ago • 4 comments

Description

When searching for a symbol that appears both in flags column and filename, highlight applies to the former. Appears to be because it finds this symbol first.

At first I thought that flags are searchable (and I would love that) but after some investigation found out this bug

Neovim version

NVIM v0.10.1
Build type: RelWithDebInfo
LuaJIT 2.1.1720049189

Operating system and version

fedora 40 (under WSL)

Telescope version / branch / rev

3b1600d

checkhealth telescope

──────────────────────────────────────────────────────────────────────────────
telescope: require("telescope.health").check()
                                                                                                                    
Checking for required plugins
- OK plenary installed.
- WARNING nvim-treesitter not found. (Required for `:Telescope treesitter`.)
                                                                                                                    
Checking external dependencies
- OK rg: found ripgrep 14.1.0
- WARNING fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities
                                                                                                                    
===== Installed extensions =====

Steps to reproduce

  1. create multiple files with "h" in the name
  2. inside neovim open the files so that they become hidden buffers
  3. open buffers picker with :lua require("telescope.builtin").buffers()
  4. try to search for a string that starts with "h"

Expected behavior

Highlight applies to filename only like that: image

Actual behavior

Here I have some hidden buffers: image

When I type "h" that is present in file names: image

Weirdly when typing more behavior differs between entries: image

Minimal config

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs { "config", "data", "state", "cache" } do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
  vim.fn.system {
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  }
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    config = function()
      -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
      require("telescope").setup {}
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

bedlamzd avatar Aug 07 '24 23:08 bedlamzd