fdschmidt93 / telescope-egrepify.nvim

Variable user customization for telescope.live_grep to set rg flags on-the-fly
MIT License
115 stars 11 forks source link

first index error fix #45

Closed milksys closed 1 month ago

milksys commented 2 months ago

If you move the arrow key up at the first index, you will end up in an infinite loop.

I don't think it's a good idea, but you shouldn't have any problems.

Press the up arrow key in the first row

image

A problem occurred

image
fdschmidt93 commented 1 month ago

This issue does not occur for me. Thanks in any case for trying to fix it!

Let's first pin the issue as such down. Can you reproduce it with a minimal_init.lua like below?

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = "/tmp/nvim/site/pack"
local lazypath = package_root .. "/lazy/lazy.nvim"
local pluginpath = package_root .. "/plugins/"
if not vim.loop.fs_stat(lazypath) then
  print "Installing 'folke/lazy.nvim'..."
  vim.fn.system { "git", "clone", "https://github.com/folke/lazy.nvim.git", lazypath }
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  {
    "fdschmidt93/telescope-egrepify.nvim",
    keys = {
      { "<space>rg", "<CMD>Telescope egrepify<CR>", mode = { "n", "i", "v" } },
    },
  },
  {
    "nvim-telescope/telescope.nvim",
    dependencies = "nvim-lua/plenary.nvim",
    config = function()
      require("telescope").setup {}
      require("telescope").load_extension "egrepify"
    end,
  },
}, { root = pluginpath })
milksys commented 1 month ago

Thank you, There was a problem with my settings.

require("telescope").setup({
  defaults = {  scroll_strategy = "limit" } -- default value : cycle
})

If scroll_strategy = "limit" of telescope, it goes beyond the index. There is no problem with the default value cycle.

https://github.com/nvim-telescope/telescope.nvim/blob/79552ef8488cb492e0f9d2bf3b4e808f57515e35/doc/telescope.txt#L134