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

bug(terminal): Focus Shift to Incorrect Split After Toggling Terminal

Open SamuelBorn opened this issue 3 weeks ago • 2 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)

0.10.3

Operating system/version

Fedora Linux

Describe the bug

If I have multiple vsplits open and toggle the terminal on and then off, always the left most window is selected afterwards. It should however jump back to the previously open one.

Steps To Reproduce

  1. nvim -u repro.lua
  2. Open split <C-w>v
  3. Jump to right window <C-w>l
  4. Open terminal :lua Snacks.terminal()
  5. Close terminal :lua Snacks.terminal()
  6. Cursor now again in left window

Expected Behavior

After close the cursor goes to the position it was before opening the terminal, notably also the same window.

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 = {
    { "folke/snacks.nvim", opts = {} },
  },
})

SamuelBorn avatar Feb 06 '25 09:02 SamuelBorn