When Undotree window is open, executing macro with a count causes multiple changes
Steps to reproduce
- Open Undotree window with
:UndotreeShow - Type
qqto record macro in register q - Type
othis is a test<Esc>qto type text in a new line and stop recording macro - Type
5@qto execute macro 5 times.
Actual: Five new changes are added to the undo list Expected: One change is added to the undo list (this is how it works when the Undotree window is closed)
Video:

this is interesting. Looks like some of the auto commands might changed the undo behaviour. btw, thanks for the video! it's super easy to repro the issue on my side thanks to it.
Was this ever resolved? I am seeing this is on nvim 0.10 nightly with latest undo tree.
Was this ever resolved? I am seeing this is on nvim 0.10 nightly with latest undo tree.
it's not
Any idea what mere the issue might be? Interesting in having a stab at this at some point. Currently having to restart without Undotree loaded when I want to run macros like this.
initially I think it might due to some autocommands that triggered a undo node creation, like exiting/entering insertion mode will do that. But that's only when the undotree panel is open. If you have to disable the plugin then I believe something else is wrong because when undotree panel is not open the auto commands shouldn't be registered. Do you mind check the auto commands by running :au BufEnter or simply :au while the undotree panel is not open, and check if there's anything related to undotree?
Nothing that could be related to undotree on BufEnter for my setup:
--- Autocommands ---
FileExplorer BufEnter
*sil call s:LocalBrowse(expand("<amatch>"))
lualine BufEnter
*lua require'lualine.components.branch.git_branch'.find_git_dir()
lua require'lualine.components.diff.git_diff'.update_diff_args()
lualine_stl_refresh BufEnter
*call v:lua.require'lualine'.refresh({'kind': 'tabpage', 'place': ['statusline'], 'trigger': 'autocmd'})
treesitter_context_update BufEnter
*<Lua 204: ~/.local/share/nvim/lazy/nvim-treesitter-context/lua/treesitter-context.lua:21>
yeah it looks normal. so you're having this issue without opening the undotree panel right?
Actually I just realized I don't have this same issue as OP. OP was talking about undo tree being open in a single buffer. My issue is actually when repeating a macro over multiple files. I'll write up a proper issue for you later with repro steps for that. Basically doing something like argdo normal @q on a list of files only works for the first one, then after that Undotree gets opened and the macro isn't executed properly on the remaining files.
undotree gets opened? is there any hotkey that opens the panel getting accidently recorded?
undotree gets opened? is there any hotkey that opens the panel getting accidently recorded?
Yes it was being opened. Was able to reproduce reliably. Was just doing a find and replace of an array attribute across multiple files. Undotree did not open while recording the macro, nor while manually replaying it. But it did when using :argdo ...
that's interesting...
Not sure what happened, but now I am really unable to reproduce it..