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

bug: telescope aerial stays at mid

Open yimingwangdell opened this issue 2 years ago • 2 comments

Neovim version (nvim -v)

latest

Operating system/version

debian

Output of :AerialInfo

xx

Describe the bug

telescope aerial cursor starts at mid.

What is the severity of this bug?

minor (annoyance)

Steps To Reproduce

any

Expected Behavior

telescope aerial cursor stays at bottom and select the correct item.

Minimal example file

No response

Minimal init.lua

-- DO NOT change the paths and don't remove the colorscheme
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.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    "stevearc/aerial.nvim",
    config = function()
      require("aerial").setup({
        -- add your aerial config here
      })
    end,
  },
  {
    "nvim-treesitter/nvim-treesitter",
    build = ":TSUpdate",
    config = function()
      require("nvim-treesitter.configs").setup({
        ensure_installed = { "c", "lua" },
        auto_install = true,
        highlight = { enable = true },
      })
    end,
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Additional context

No response

yimingwangdell avatar Feb 20 '24 09:02 yimingwangdell

after researching, I found that when running "Telescope aerial", the cursor by default starts on the nth item related to nth function your cursor located. it should be starting on last(bottom) item. because last item is most matched item.

yimingwangdell avatar Feb 20 '24 09:02 yimingwangdell

@stevearc

yimingwangdell avatar Feb 20 '24 09:02 yimingwangdell

The cursor starts on the current symbol, and the symbols are ordered the same way they are in the file. Once you start typing and the number of results changes, the cursor jumps to the last item. This all seems correct to me.

Is your request to have the cursor start on the last symbol in the file, regardless of where your current cursor position is?

stevearc avatar Jun 06 '24 03:06 stevearc

@stevearc sometime it didn't work. if I type only one character, there is no preselected item at bottom. then if I type <up> to preselect one item, it was not the last one.

yimingwangdell avatar Jun 07 '24 08:06 yimingwangdell

I think that what is happening is that telescope only moves the cursor to the bottom after the total number of results displayed has changed. If you type a single character that doesn't filter out any of the results, the cursor will stay somewhere in the midpoint. Is this the behavior you are seeing? This is arguably a bug in telescope since that is probably not intentional behavior, but it also is generally not an issue in practice since typing two characters is usually enough to filter out at least one result.

stevearc avatar Jun 08 '24 12:06 stevearc