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

When Undotree window is open, executing macro with a count causes multiple changes #111

Open
Asheq opened this issue Jan 9, 2020 · 12 comments
Assignees
Labels

Comments

@Asheq
Copy link

Asheq commented Jan 9, 2020

Steps to reproduce

  1. Open Undotree window with :UndotreeShow
  2. Type qq to record macro in register q
  3. Type othis is a test<Esc>q to type text in a new line and stop recording macro
  4. Type 5@q to 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:
example

@mbbill
Copy link
Owner

mbbill commented Jan 10, 2020

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.

@mbbill mbbill self-assigned this Jan 10, 2020
@mbbill mbbill added the bug label Jan 10, 2020
@Asheq Asheq closed this as completed Oct 19, 2023
@MXfive
Copy link

MXfive commented May 3, 2024

Was this ever resolved? I am seeing this is on nvim 0.10 nightly with latest undo tree.

@mbbill mbbill reopened this May 6, 2024
@mbbill
Copy link
Owner

mbbill commented May 6, 2024

Was this ever resolved? I am seeing this is on nvim 0.10 nightly with latest undo tree.

it's not

@MXfive
Copy link

MXfive commented May 7, 2024

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.

@mbbill
Copy link
Owner

mbbill commented May 7, 2024

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?

@MXfive
Copy link

MXfive commented May 7, 2024

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>

@mbbill
Copy link
Owner

mbbill commented May 7, 2024

yeah it looks normal. so you're having this issue without opening the undotree panel right?

@MXfive
Copy link

MXfive commented May 7, 2024

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.

@mbbill
Copy link
Owner

mbbill commented May 7, 2024

undotree gets opened? is there any hotkey that opens the panel getting accidently recorded?

@MXfive
Copy link

MXfive commented May 7, 2024

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 ...

@mbbill
Copy link
Owner

mbbill commented May 7, 2024

that's interesting...

@MXfive
Copy link

MXfive commented May 8, 2024

Not sure what happened, but now I am really unable to reproduce it..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants