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

Dressing window remains open after entering command line window #99

Closed
smjonas opened this issue Jun 1, 2023 · 2 comments
Closed

Dressing window remains open after entering command line window #99

smjonas opened this issue Jun 1, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@smjonas
Copy link

smjonas commented Jun 1, 2023

Describe the bug
Problem: I want to close dressing's vim.ui.input window while the command window is open to solve this issue: smjonas/inc-rename.nvim#37. I would expect the window to be automatically closed once command line mode is entered (since that exits dressing's buffer and should trigger the BufLeave autocommand here). Also note that after running the below DressingBug command, calling require("dressing.input").close() has no effect and the window remains in an "orphaned" state.

System information

  • OS: Linux
  • Neovim version: NVIM v0.10.0-dev-2992+g2bdef6dd2
  • Dressing config:
require("dressing").setup{}

To Reproduce
Steps to reproduce the behavior:

  1. Copy the following user command to your config and source the file:
vim.api.nvim_create_user_command("DressingBug", function()
  vim.ui.input("Test", function() end)
  -- Exit insert mode and enter command line mode
  vim.cmd.stopinsert()
  vim.api.nvim_feedkeys(":", "n", false)
 -- Enter cmdline window
  local ctrl_f = vim.api.nvim_replace_termcodes("<C-f>", true, false, true)
  vim.api.nvim_feedkeys(ctrl_f, "n", true)
  -- Leave cmdline window
  vim.schedule(function()
    vim.cmd("q")
  end)
end, {})
  1. Run the command
  2. Exit the dressing window (e.g. with <C-w>w)
    Notice that the window was exited but remains open (see screenshot).

Running require("dressing.input").close() also has no effect.

Screenshots
image
This shows that the cursor is placed outside of the input window which should not be possible.

@smjonas smjonas added the bug Something isn't working label Jun 1, 2023
@stevearc
Copy link
Owner

stevearc commented Jun 2, 2023

I put in a fix for this. It seems to work from my testing, but I unfortunately couldn't get a repro to happen in a unit test. LMK if this works for you

@smjonas
Copy link
Author

smjonas commented Jun 3, 2023

Thanks for the quick fix, your patch seems to work fine!

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

2 participants