echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.88k stars 185 forks source link

Issue with insert mode in mini.files when configuring height of window #1179

Closed adriankarlen closed 3 weeks ago

adriankarlen commented 3 weeks ago

Contributing guidelines

Module(s)

mini.files

Description

When using MiniFilesWindowUpdate-event to update window height via config, the cursor placement hops back when inserting first letter if the window height is configured to be larger than the file list. I've recorded the issue.

https://github.com/user-attachments/assets/e137829f-60a6-4f6a-9b9c-fde6232e5662

The issue does not appear when the filelist is larger than the configured height.

I've tested it with only this event in my config.

Neovim version

0.10.1

Steps to reproduce

  1. add the following event:
    vim.api.nvim_create_autocmd("User", {
    pattern = "MiniFilesWindowUpdate",
    callback = function(args)
    local config = vim.api.nvim_win_get_config(args.data.win_id)
    config.height = 15
    vim.api.nvim_win_set_config(args.data.win_id, config)
    end,
    })
  2. Open mini.files, and navigate to an directory with fewer than 15 entries.
  3. Create a new file.

Expected behavior

If I type hello.lua, it should become the file name.

Actual behavior

The file name becomes ello.luah

echasnovski commented 3 weeks ago

Thanks for the issue!

I can reproduce. Will look into it.

echasnovski commented 3 weeks ago

This should now be fixed on latest main.