cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Undo triggers in wrong file when using split windows

Open bbonf opened this issue 2 years ago β€’ 10 comments

Not sure if this is a bug or a configuration issue:

When using a split editor, issuing an undo command will always undo the last edit that was done in the current file. But when working with two files in a split view, this is often not the desired outcome. I would expect it to always undo the last command/edit across all files. This is especially annoying when running into a recognition error, or when using the wrong hat. In my setup it's trivial to reproduce, but please let me know if there's more info I could provide.

That being said, many thanks for your work on cursorless, it's really great! πŸ‘

bbonf avatar Nov 28 '23 09:11 bbonf

Glad you're liking Cursorless! ☺️

Undo is a VSCode feature, so maybe it would make sense to file the issue there? We have no control over VSCode's built-in undo functionality

pokey avatar Nov 28 '23 11:11 pokey

It's a tricky point, because I can't imagine most keyboard users would be happy with undo-s that switch around between the visible split editors. When using the keyboard, I think it does make more sense to undo only in the current editor. Anyway, I think this requires some more consideration.

bbonf avatar Nov 28 '23 12:11 bbonf

Yeah it's a fair point. Fwiw here are some relevant links:

  • #317
  • https://github.com/paul-schaaf/big-undo (haven't tried it yet, and not sure if it's cross-editor, but seems relevant)

pokey avatar Dec 06 '23 19:12 pokey

You can also use a Cursorless custom action if you want to be able to undo and redo across a split

"undo blue air"

undo, undo
redo, redo

https://github.com/AndreasArvidsson/andreas-talon/blob/23b7da3a62057c54f33f22d30f018ae8c896d8c0/settings/cursorless-settings/experimental/actions_custom.csv#L6-L7

AndreasArvidsson avatar Dec 08 '23 14:12 AndreasArvidsson

You can also use a Cursorless custom action if you want to be able to undo and redo across a split

"undo blue air"

How did that never occur to me πŸ˜…. Are you using that?

Btw if you unmap "undo that", then for actions that only target one split, saying "undo that" would just work in the right split πŸ€”. We could even support commands that group by editor and run once for each editor and it would just undo in multiple splits if necessary πŸ˜„

pokey avatar Dec 12 '23 14:12 pokey

Yes :)

I'm already using that. For me it's just undo and undo last where last is the Cursorless that mark

AndreasArvidsson avatar Dec 12 '23 14:12 AndreasArvidsson

that's great. added myself πŸ‘

pokey avatar Dec 12 '23 15:12 pokey

Just did the same for save:

disk, workbench.action.files.save

So now I can say "round wrap air" in opposite split then "disk that"

pokey avatar Dec 13 '23 14:12 pokey

Just did the same for save:

disk, workbench.action.files.save

So now I can say "round wrap air" in opposite split then "disk that"

Nice. I have disk files to save all open files which I use kinda similarly.

AndreasArvidsson avatar Dec 13 '23 14:12 AndreasArvidsson

Nice. I have disk files to save all open files which I use kinda similarly.

Yeah that's what I usually use but I like the precision of this one, because sometimes that triggers annoying save untitled popup

pokey avatar Dec 13 '23 18:12 pokey