kndndrj / nvim-dbee

Interactive database client for neovim
GNU General Public License v3.0
602 stars 39 forks source link

[BUG] When closing dbee window, previous tab is changed to empty buffer #120

Open Rizhiy opened 3 weeks ago

Rizhiy commented 3 weeks ago

Steps to reproduce:

  1. Open a file with vim
  2. Create new tab (:tabnew)
  3. Open dbee in new tab
  4. Close dbee (e.g. with :q)

Expected outcome: All relevant buffers are closed correctly, and you are either left with whatever was open before you opened db or the other tab.

Actual outcome: tab with dbee is closed, the first tab is change to a single empty buffer (even if there were multiple splits open before).

yofriadi commented 2 days ago

I have the same problem, when I open more than 1 tab, it closed any last tab I have attached screen record of the problem

https://github.com/kndndrj/nvim-dbee/assets/24536844/7f10bc37-f277-4183-85e7-d4e1de655d7b

I have tab 1,2,3 then when I open nvim-dbee and close it, tab 3 disappeared and move all tab 3 buffer to tab 2.

also posting Discord discussion link with AstroNvim creator that think there is bad tab management things and it's close function https://discord.com/channels/939594913560031363/1257715805743747216/1257715805743747216

mehalter commented 2 days ago

Here is a reproducing minimal configuration:

-- 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", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
    {
        "kndndrj/nvim-dbee",
        dependencies = {
            "MunifTanjim/nui.nvim",
        },
        build = function()
            -- Install tries to automatically detect the install method.
            -- if it fails, try calling it with one of these parameters:
            --    "curl", "wget", "bitsadmin", "go"
            require("dbee").install()
        end,
        config = function()
            require("dbee").setup(--[[optional config]])
        end,
    },
}
require("lazy").setup(plugins, {
    root = root .. "/plugins",
})

Steps to Reproduce

  1. Save the above in a folder named repro.lua
  2. rm -rf .repro, make sure to clean any previous repro environment (fine if this errors, it means no previous environment)
  3. nvim -u repro.lua, start up neovim with the repro.lua file and let it install
  4. q, close out of Lazy plugin manager
  5. :e repro.lua, open a file
  6. :tabnew, make a new tab (see the new tab in the tabline on the top
  7. i, go into insert mode
  8. Hello, World!, insert some text
  9. <Esc>, leave insert mode
  10. :lua require("dbee").open(), open the dbee interface
  11. :lua require("dbee").close(), close dbee
  12. see that we are now down to a single tab and our 1st tab is closed leaving us with only our Hello, World!