Undo (Ctrl+Z) undoes more than one last step

Steps to reproduce

  1. Go to any youtube video (for example here)
  2. Select one line with the name of the channel (in this case “DistroTube”)
    image
  3. Write "Test " in a document.
  4. Press Ctrl+Ins(Ctrl+C) to copy.
  5. Go to Obsidian document and write "Test ".
  6. Press Shift+Ins (Ctrl+V) to paste. The result should look like this:
Test [DistroTube](https://www.youtube.com/channel/UCVls1GmFKf6WlTraIb_IaJg)

image
7. BUG: Press Ctrl+Z to undo. You will see that the whole line will be deleted, not only the youtube link.

Expected result

Only the last step should be undoed. Typing and pasting are clearly two different steps/activities.

Environment

  • Operating system: Linux Mint 20.2 Cinnamon
  • Obsidian version: 0.12.10

Additional information

This bug shows itself with youtube channel links. Everything works fine with most other copy-pasted text. Including if you paste+select+copy the same exact youtube channel link and try to reproduce the bug… :exploding_head:

I have seen other cases where codemirror has these kinds of undo issues. This is due to the particulary way it handles history. If you find other examples where this happens, open a BR directly to them.

To make sure I understand correctly:

  1. Obsidian uses Codemirror editor.
  2. This is not a bug in Obsidian per se. Or at least Obsidian team can’t (won’t?) fix the issue in their own code. So this bug report details should be reported directly to the Codemirror team.

Where can I find what version of Codemirror Obsidian uses? I am sure Codemirror developers want to know such detail.

on desktop obsidian uses CM5 on mobile CM6. Eventually everything will be on CM6.

1 Like

I reported the bug to the CodeMirror developers. Their answer:

marijnh 8 days ago

Sorry, I’m not debugging problems that involve integrations. And more generally, not very sure that this is a CodeMirror bug. It sounds like the Obsidian link pasting behavior replaces the entire line, and that’s what’s causing this behavior.
marijnh closed this issue 8 days ago

I’ve replied to the closed issue, but if they don’t reopen it after a few days, you should probably file a new one using the code from my reply:

1 Like

will be fixed in 0.12.14

2 Likes

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