obsidian.nvim icon indicating copy to clipboard operation
obsidian.nvim copied to clipboard

Undo History Messed Up When Obsidian App Open

Open VioletJewel opened this issue 1 year ago • 2 comments

🐛 Describe the bug

Open a file with, eg, :ObsidianNew. Open that file in obsidian with, eg, :ObsidianOpen. Type some text (like with GoHello). Save the file with :up. Change the text (like with GciwBye). Save again: :up. Undo with U and notice that the cursor is positioned at the top of the document but that the document is the same and did not undo the last change. If you do u once more, then it actually undoes the change.

It seems like if you have obsidian open, then every time you :write (or :update) the file, obsidian replaces the entire file with the same text. Even if I do :set noautoread, somehow the undo history is messed up. I don't even see it in :undolist, so I'm not sure exactly what is happening.

Please help. I keep trying to do incremental changes with the obsidian graphviz community plugin (yes, I disabled and removed it completely to verify that this is not the cause), and every time I write the file, I can't undo easily because it keeps making my cursor jump to the top of the file and I have to undo a lot on top of it truncating my undo history (can't redo with CtrlR. It's really annoying and completely unusable as is for what I am trying to do.

I'm on linux btw.

Versions

NVIM v0.10.0-dev-1722+g884a83049b Build type: RelWithDebInfo LuaJIT 2.1.1702233742

obsidian.nvim (v2.6.0)] Commit SHA: 86caccdac82e78a268e25fab901f47bc36ccd33c [plenary.nvim] Commit SHA: 55d9fe89e33efd26f532ef20223e5f9430c8b0c0 ripgrep 14.1.0

VioletJewel avatar Jan 15 '24 19:01 VioletJewel

I think :undojoin might be able to solve this problem

segeljakt avatar Jan 16 '24 09:01 segeljakt

On Mac it seems to work as expected. Is this still an issue? Either way, I don't think this a bug with obsidian.nvim.

epwalsh avatar Feb 22 '24 16:02 epwalsh