Undo deletes too much

(I searched for “undo”. Didn’t find my issue…"

Steps to reproduce

I write some text. Press enter twice. Paste a link.
Oops. I wanted to paste with CTRL+Shift+v.
So I undo. CTRL+z
Undo removes my pasted link, good. But undo also remove A PART of the text I wrote.

OR:
Just write text with 3 words. Press undo. Everything disappears! Not good.
Undo-by-word is an ok behavior.

Expected result

Undo should work “atomically”, like in any other editor. Like VSCode for example.
Undo can clump things together, yes, like words and such, but NOT like Obsidian does for me currently.

When I paste a link, and click Undo, only the pasted link should disappear.

When I write text, only single character should disappear with undo (like in this browser editor right now), or single words like in VSCode (and likely most text editors).

Actual result

Part of the text I had written before pasting has F***** diappeared.
So now I have to context switch. Rewrite it back.
Then paste again.

I’ve actually gotten into a loop, where I “(re)write + paste + undo” several times,
because when I have to try to remember what I just wrote and paste again,
I again forget to press the Shift (aka paste as raw text).
So I have to undo again. And again it removes part of what I wrote. So I rewrite, etc.

Sometimes I write code examples, and loosing parts of code is like… really really bad.
Really have to think hard to recreate what suddenly disappears.

And I have actually lost parts of my notes because of this.
I have Undoed, but have not noticed that also my previous writing is deleted.

Environment

  • Operating system: Win10
  • Obsidian version: v0.11.13

Additional information

I quite dislike bug reports where people threathen to “stop using your software if fix is not immediately there”. But in this case I really reluctantly have to switch back to VSCode (and start to look for an alternative).
I can’t have a text editor potentially delete parts of my notes due to strangely behaving undo. :frowning:

2 Likes

Has this started happening recently?

I did some tests and I am not sure I can full reproduce your problem.

Codemirror undo is definitely different from VScode undo but I can’t reproduce your problem.

Please, post a screen recording on the help vault.

I faced that problem many times on Mac.
Obsidian Revert bug

Let me be clearer. The fact that when you undo, it deletes multiple words that you just typed is normal, it’s what what codemirror does, you can try it yourself on their demos. Codemirror uses a idle timer to determine undo points (among other things).
You may not like it, but it’s not a bug per se.

What I can’t reproduce is. Type->paste->type, undo deletes everything.

Maybe if you type > (then really fast, no pause here) > paste > and then undo? I feel like I have had this happen too but not as catastrophically as the OP. Either way if it’s a codemirror thing there’s not much that can be done.