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

fix(buffers): select_current not selecting current buffer index #3147

Merged
merged 1 commit into from
Jun 9, 2024

Conversation

pirey
Copy link
Contributor

@pirey pirey commented May 31, 2024

Description

When using builtin.buffers with select_current = true, it is not selecting current buffer.
This is because the current implementation tries to set the default_selection_idx using buffer number instead of buffer index.

The solution is to set default_selection_idx using buffer index.

Fixes #2917

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

:lua require('telescope.builtin').buffers({ select_current = true })

Configuration:

  • Neovim version (nvim --version):
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
  • Operating system and version: Windows 11 / WSL

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

Copy link
Contributor

@dam9000 dam9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks good and I tested it. It fixed an issue that I also observed - select_current was working only for the files that were provided through the command line but not for any new files opened afterwards from within nvim. Now that works too.

@jamestrew jamestrew merged commit 7231b52 into nvim-telescope:master Jun 9, 2024
12 checks passed
@jamestrew
Copy link
Contributor

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

buffers picker: add select_current option (PR included)
3 participants