Undo is a mess - unable to revert to previous code

When using either ctrl+k or ctrl+l with apply for code creation, undo a total mess.

It’s super hard to revert to a previous state!

When using ctrl+k, the undo initially goes to the text input box. I think it’s fair to assume the user doesn’t want to edit their prompt, but undo the code.

Same with ctrl+l with apply, it leaves a mess of legacy prompts that can’t be cleared.

I would like the interface to only consider removing the code changes when using undo, rather than the entire history of user interaction with the AI

8 Likes

Could you send a video of this? on my end, seems like it first affects the change, and then the prompt

On a Mac, it’s just Cmd-Z twice, did you try?

1 Like

the same here

Version: 0.40.3
VSCode Version: 1.91.1
Commit: 2804893a83ef162ae6c48e8254717e25c7c7c510
Date: 2024-08-29T17:42:50.254Z
Electron: 29.4.0
ElectronBuildId: undefined
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.22631

Really disastrous logic for undo though Cursor AI is so good itself. I assume it can be specified where to undo by cursor position or differentiated shortcuts.
Please improve on this.

3 Likes

As a vim user, I undo with u in normal mode and agree that undoing a little bit messy. When I want to undo to a previous state, as soon as the undo focuses to the text input box, I end up typing bunch of uuuus.

I don’t think that an undo should trigger the command+k box. I think when the cmd+k box is disabled,undoing should just focus to the editor. This enhancement would improve my work flow significantly.

there is a video recording of my annoyance on this comment

2 Likes

For me the biggest issue with Undo is that around the quarter of the time it’ll actually permanently delete code and end up with a garbled mess. I’ve lost code over this. I suspect it has to do with vscode vim.

Sadly vscode without vim is pretty unusable for me. I’d pay 3x for an official cursor neovim plugin. They probably wouldn’t make money on it though :laughing:

I know you removed your comment. I did add start forwarding the undo/redo to vscode and a very interesting side effect here is that it also keeps the cmd K prompt in the undo stack. I suppose that’s how it works w/o vscode-nvim I just never experienced it since I immediately installed the ext.

So far it does work better this way even though I’d prefer to just undo the output rather than the cmd inputs as well. Thanks.

Happy that remapping vim undo/redo to vscode undo/redo worked. I also lost some amount of code before this remapping and I think it works pretty good.

However this remapping will make the OP’s issue even more annoying as it adds random uuus to the undo stack :upside_down_face:

1 Like

Terrified to even press “u” now because I’m afraid it will undo the last composer apply. Anyone else still seeing this?

undo is still a mess, somehow i lost the code. especially the apply update replacing whole logic.

so either need back to codebase (based on chat) or apply a copy

Hey, is our checkpointing feature not working here for you?
That should reset your whole codebase and chat to the point before the AI had made any changes!

Screenshot 2025-01-23 at 12.47.16

I’ve noticed that the Checkpoint restore seems to get confused if you’ve done some work in Composer and applied some code in Chat.

At last I think that might be related since I’ve done some work in both, and restoring doesn’t bring things back to that state and I have to do manual cleanup or cherry pick…

Yeah, I don’t think the process for applying an old code suggestion after further edits have been made works well.

If you want to re-apply an old change, I’d recommend getting the Composer to re-write its suggestions, so you are only applying the latest changes!

Switched to neovim and life is much better now.

THIS IS a VERY conspicuous theme and long ongoing issue my friend experienced. Literally trashed her project and the system crashed when she tried to recover her work…

Not only had Cursor over wrote script without authority… It did so as she was testing out what she thought were suggestions… Made worse by the so so-called solutions not only misaligning from the script - Functionality was removed

Since then she has tried to make sense of what happened while having (through oversight) not made a back up of her work to that point - So a major step backwards

From correspondence, to say little to no support has left her deeply upset

I have the same issue. The only advice I can give is to always commit your changes after getting something working the way you want it. That way you can just “git checkout .” to clear and go back to it if things get messy and the ai starts chasing its tail.