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

BUG: move and copy floating window were wrapped. #1632

Open
3 tasks done
Kaiser-Yang opened this issue Dec 30, 2024 · 3 comments
Open
3 tasks done

BUG: move and copy floating window were wrapped. #1632

Kaiser-Yang opened this issue Dec 30, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Kaiser-Yang
Copy link

Kaiser-Yang commented Dec 30, 2024

Did you check docs and existing issues?

  • I have read all the docs.
  • I have searched the existing issues.
  • I have searched the existing discussions.

Neovim Version (nvim -v)

0.10.1

Operating System / Version

WSL2 + Ubuntu 22.04 LTS

Describe the Bug

When use 'move' or 'copy' the text input windows are too small, so the lines are wrapped, and can not see the contents:

image

For the rename popup, it works well, it can extend the NeoTree windows.:

image

Screenshots, Traceback

No response

Steps to Reproduce

Move or copy a file with long path.

Expected Behavior

The windows can extend like the rename windows

Your 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 = {
  "folke/tokyonight.nvim",
  -- add any other plugins here
}

local neotree_config = {
  "nvim-neo-tree/neo-tree.nvim",
  dependencies = { "MunifTanjim/nui.nvim", "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim" },
  cmd = { "Neotree" },
  keys = {
    { "<Leader>e", "<Cmd>Neotree<CR>" }, -- change or remove this line if relevant.
  },
  opts = {
    -- Your config here
    -- ...
            use_default_mappings      = false,
            filesystem                = {
                window = {
                    mappings = {
                        ["a"] = {
                            "add",
                            config = {
                                show_path = "absolute"
                            }
                        },
                        ["A"] = "add_directory",
                        ["r"] = "rename",
                        ["m"] = {
                            "move",
                            config = {
                                show_path = "absolute"
                            }
                        },
                        ["c"] = {
                            "copy",
                            config = {
                                show_path = "absolute"
                            }
                        },
                    },
                },
            },
  },
}
table.insert(plugins, neotree_config)
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
@Kaiser-Yang Kaiser-Yang added the bug Something isn't working label Dec 30, 2024
@Kaiser-Yang
Copy link
Author

Kaiser-Yang commented Dec 30, 2024

I've found the problem. Not only should the width of popup be determined by the title length, but the content length:

image

BTW, the mid_width in this function is not used.

@Kaiser-Yang
Copy link
Author

Kaiser-Yang commented Dec 30, 2024

I've fixed this:

  1. First update width with max(width, min_width):

image

  1. Use 1.5 * #default_value or 10 as the min_width:

image

This works well, , may add a configuration option for the 1.5 is a better way.

211b00f9b3fadf9bff45f79bff00a26a

@Kaiser-Yang
Copy link
Author

Kaiser-Yang commented Dec 30, 2024

BTW, without strict type, configuration for neo-tree is very hard, and it is also hard for other developers not familiar with this plugin. For now, I don't even know what fields a state or node actually have. I only could search from all the source code to know by checking what were got by a ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant