Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort_lastused selection behavior #3262

Open
nowaylifer opened this issue Aug 18, 2024 · 1 comment · Fixed by #3289
Open

sort_lastused selection behavior #3262

nowaylifer opened this issue Aug 18, 2024 · 1 comment · Fixed by #3289
Labels
bug Something isn't working reproducible Bug that can be reproduced.

Comments

@nowaylifer
Copy link

Description

When using buffers picker with sort_lastused option enabled, entry at index 2 stays selected until only one entry left, even though there's better match at index 1. With additional option 'ignore_current_buffer` enabled selection works as expected.

Neovim version

NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1720049189

Operating system and version

arch linux

Telescope version / branch / rev

master branch commit 5972437

checkhealth telescope

telescope: require("telescope.health").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

Steps to reproduce

  1. nvim -nu minimal.lua
  2. open some buffers
  3. run Telescope buffers sort_lastused=true
  4. start typing

Expected behavior

After start typing in buffers picker with sort_lastused option enabled, selection goes to entry at index 1.

Actual behavior

sort_lastused.wierd.behavior.mp4

With ignore_current_buffer enabled:

ok.with.ignore_current_buffer.mp4

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",
})
@nowaylifer nowaylifer added the bug Something isn't working label Aug 18, 2024
@jamestrew jamestrew added the reproducible Bug that can be reproduced. label Sep 12, 2024
@jamestrew
Copy link
Contributor

I misinterpreted the issue in #3289
Looks like the selection starting on the second entry is correct -- just shouldn't say like that.

@jamestrew jamestrew reopened this Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproducible Bug that can be reproduced.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants