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

bug(picker): `ui_select` integration has bugs when multiple selections happen in succession

Open mehalter opened this issue 9 months ago • 4 comments

Did you check docs and existing issues?

  • [x] I have read all the snacks.nvim docs
  • [x] I have updated the plugin to the latest version before submitting this issue
  • [x] I have searched the existing issues of snacks.nvim
  • [x] I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.11.0-dev-1971+g092529ebbf (also tested with stable 0.10.4)

Operating system/version

Arch Linux

Describe the bug

When interacting with some vim.ui.select prompts the snacks.picker implementation clobbers the interactions if they happen in succession. I have found an extremely reproducible case with Neogit and am using that as an example.

Steps To Reproduce

  1. nvim -u repro.lua, open the minimal reproducing configuration
  2. :cd some/git/path, change directories to a git repository
  3. :Neogit, open Neogit
  4. dr, do the keyboard command for doing a diff range (this leads to 3 vim.ui.select calls in succession)
  5. <CR>, Make a selection from the first selection
  6. See that nothing happens and the future selections are clobbered

A good test is to remove snacks from the repro.lua and redo the steps and see that you get more selections after the first one.

Expected Behavior

The snacks.picker for ui_select should work properly in all cases where vim.ui.select works by default.

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system "curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua")()

require("lazy.minit").repro {
  spec = {
    { -- Add neogit as this has a case where this happens
      "NeogitOrg/neogit",
      dependencies = {
        "nvim-lua/plenary.nvim",
        "sindrets/diffview.nvim",
      },
      opts = {},
    },
    { -- add snacks and enable the `ui_select` for picker
      "folke/snacks.nvim",
      lazy = false,
      priority = 1000,
      opts = {
        picker = { ui_select = true },
      },
    },
  },
}

mehalter avatar Mar 12 '25 16:03 mehalter

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 12 '25 02:04 github-actions[bot]

This isn't stale. It is still an issue

mehalter avatar Apr 12 '25 02:04 mehalter

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar May 14 '25 02:05 github-actions[bot]

This isn't stale

mehalter avatar May 14 '25 02:05 mehalter

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jun 14 '25 02:06 github-actions[bot]

Still not stale

mehalter avatar Jun 14 '25 02:06 mehalter

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jul 30 '25 02:07 github-actions[bot]

not stale

mehalter avatar Jul 30 '25 02:07 mehalter

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Sep 01 '25 02:09 github-actions[bot]

Not stale

mehalter avatar Sep 01 '25 02:09 mehalter

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Oct 03 '25 02:10 github-actions[bot]

Not stale

mehalter avatar Oct 03 '25 02:10 mehalter

Just tested and it all works fine for me.

I did fix a million issues over the last two days, so this may have been fixed.

folke avatar Oct 22 '25 19:10 folke