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

mini.operators leaves behind marks when undoing actions #941

Open
3 tasks done
PowerUser64 opened this issue Jun 4, 2024 · 1 comment
Open
3 tasks done

mini.operators leaves behind marks when undoing actions #941

PowerUser64 opened this issue Jun 4, 2024 · 1 comment
Labels
bug Something isn't working mini.operators

Comments

@PowerUser64
Copy link

Contributing guidelines

Module(s)

mini.operators

Description

mini.operators' exchange function leaves behind marks when undoing.

Neovim version

0.10.0

Steps to reproduce

mini.operators.bug.webm
  • gxE (start exchange)
  • WW (go to the next thing we want to exchange)
  • . (run the exchange operation)

(good so far)

  • u (undo the exchange)

oh no, we now have two marks on this line (x and y)!

Note that here, marks.nvim is used to display (and later delete) the marks that the exchange operation leaves behind, but it is reproducible without it.

Expected behavior

mini.operators should leave marks the same as they were before the edit was performed, and not re-place them when an edit is undone.

Actual behavior

mini.operators currently causes the x and y marks to be replaced when undoing a change done by the exchange operation.

@PowerUser64 PowerUser64 added the bug Something isn't working label Jun 4, 2024
@echasnovski
Copy link
Owner

Thanks for the issue!

'mini.operators' does the best I could find to not have any side effects. It uses marks x and y as temporary marks for a more proper yanking of selected pair of text regions. They are restored to what they were prior to exchange.

Expected behavior

mini.operators should leave marks the same as they were before the edit was performed, and not re-place them when an edit is undone.

Actual behavior

mini.operators currently causes the x and y marks to be replaced when undoing a change done by the exchange operation.

So it does leave them as they were before the edit. Undoing the edit is not done by 'mini.operators' itself, so it has little control over it.

I'll take a look if it is feasible for "exchange" to do its edit in a way that works with this "undo" use case, but I'd say that this both 1) doesn't look like a huge issue; and 2) may be very convoluted to actually achieve.

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

No branches or pull requests

2 participants