Delete Paragraph command should register in the undo stack

If you type quickly and make a mistake, like using the “delete line” shortcut on macos, Obsidian doesn’t restore your text on CMD+Z.

Here is a screen cap of losing a complete sentence to Obsidian’s Undo:

I try to use CMD+Z at the end of the video, but Obsidian “forgot” my sentence.
I couldn’t reproduce this issue on other editors or text inputs.

Is there a fix somewhere? I can’t count how often I lost whole sentences to a typo.

Did you mean “Delete Paragraph”? Cmd-D?

  • I can reproduce this on MacOS 12.6.3 Monterey.
  • Obsidian 1.4.0 (installer 1.3.5)
  • Tested in the Sandbox vault.
  • I haven’t tested in Windows.

If I am typing, and then type “Cmd-D” to delete the paragraph, then that paragraph is lost, and the undo stack restores something older.

If I wait about 1 or 2 seconds, the effect doesn’t happen. It only seems to happen if you trigger the command quickly after typing your last character(s).


(Often people make bug reports that should have been posted in help. This seems to be the opposite. I think it would have been better for you to fill out the template and report a bug. I’m just going to move it to Bug Reports.)

I think it’s better if your rewrite this as a BR and you are specific about what specifically should be handled differently. The undo logic is very complex.

Also, read this https://codemirror.net/docs/ref/#commands and try here using chrome https://codemirror.net/try/?example=Markdown%20code%20block%20highlighting

If it happens, open a BR directly upstream https://github.com/codemirror/dev/issues

There is no “Delete Paragraph” command in that CodeMirror link.

As for what specifically should be handled differently, the Obsidian “Delete Paragraph” command should register in the undo stack.

Do deletetoLineStart and End work in Obsidian and Codemirror website?

1 Like

No, they are both broken too.

I see, BR should be upstream with CodeMirror.

Did you mean “Delete Paragraph”? Cmd-D?

No, I mean Delete Line, CMD + DELETE
Looks like I’ve been heard, and you’re on it. Thanks team for looking into this :slight_smile:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

is this still happening in obsidian 1.6?

I think so?

If I type quickly and then use Cmd-D then the thing I typed gets clumped into the undo stack, and gets lost and can’t be redone.

Cmd-fn-delete (Cmd-Backspace) clumps into the undo stack, but it seems to redo just fine. (I think this is what OP was writing about. But I can only seem to reproduce with Cmd-D.)