nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.43k stars 824 forks source link

Selection caret does only appear after search is complete #3257

Open SamuelBorn opened 1 month ago

SamuelBorn commented 1 month ago

Description

I often do long searches (for example a live grep in a large project). Even with fzf-native enabled the search can take several seconds to complete. Often times the item I want to select is already at the bottom. I cannot select this item, because the selection caret only appears after the full search is complete.

Here is a video. Notice the orange caret appears only at the end. Before it appears pressing has no effect. https://github.com/user-attachments/assets/1bfb1ce6-daef-4f29-9abf-8fb4dfb18468

Neovim version

NVIM v0.10.1
Build type: RelWithDebInfo
LuaJIT 2.1.1720049189

Operating system and version

Fedora 40

Telescope version / branch / rev

commit: 5972437 (at the time of writing it is the newest commit on the main branch)

checkhealth telescope

==============================================================================
telescope: health#telescope#check

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 14.1.0
- OK fd: found fd 10.1.0

===== Installed extensions ===== ~

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Telescope Extension: `smart_open` ~
- No healthcheck provided

Steps to reproduce

  1. Open nvim in large folder (e.g. home folder for demonstration purposes)
  2. Use an expensive operation (e.g. live_grep, or find_files) and search for something super generic like 't'

Expected behavior

The selection caret is always at the most bottom element. If I want to select the current most bottom file while the search is still running I can do so by just pressing enter.

Actual behavior

The selection caret only appears after the search is finished. I cannot select the most bottom item while the search is running just by pressing Return.

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()
      -- not strictly necessary, but useful for testing
      vim.keymap.set("n", "sg", require("telescope.builtin").live_grep)
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})
SamuelBorn commented 3 weeks ago

Related Issue: https://github.com/danielfalk/smart-open.nvim/issues/79