Table undo/redo bugs

Steps to reproduce

Copy this table into a new note:

| aaa             |
| --------------- |
| bbbbbb          |
| ccccccccc       |
| ddddddddd       |
| eeeeeeeeeeee    |
| fffffffffffffff |

Then edit one of the cells, except the first or the last cell, for example by adding a highlight (I selected the bbbbbb and pressed = twice).

Then alternatingly press ⌘Z and ⇧⌘Z.

Did you follow the troubleshooting guide? [Y/N]

Y

Expected result

After pressing undo and redo several times I should end up where I was before.

Actual result

First a space is added at the start of the cell that was edited. Then markup/content from subsequent rows keeps getting added to the cell.

If I click outside the table and press undo/redo again it usually resolves itself.

Also, sometimes the undo and redo shortcuts stop having any effect at all until I click somewhere outside the table. Even then, pressing ⌘Z and ⇧⌘Z does not always return me to the same state, sometimes causing the edited cell to appear blank.

Environment

SYSTEM INFO:
	Obsidian version: v1.5.12
	Installer version: v1.5.3
	Operating system: Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:06 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T8103 23.4.0
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on

RECOMMENDATIONS:
	none

Additional information

It seems to have something to do with subsequent rows/cells being longer. When they are the same length or shorter, the bug did not happen in my tests.

Video: https://i.imgur.com/eKwSpvC.mp4

It is just a rendering bug (but still a bug). No data is lost. You can get the correct view back by clicking into another cell then back.

That is not the case. I have lost data after pressing undo a few times. Just now I watched it happen. I pressed undo a few times and one of the cells (from a column preceding one that I edited) was erased. Then I pressed redo a few times and the cell content was still not back. Additionally, several extra columns had been created/duplicated during that process. Clicking into or out of the affected cells did not bring back the data or remove the duplicated columns.

Neighboring rows are also being affected, with edited cells being split and overwriting cells below them (easy to go unnoticed imho). I cannot share the data I’m editing and I’m not sure how to consistently reproduce these errors, so it might be technically a different bug than what I showed in the simplified examples previously, but I believe it’s related.

Let me know if still get this problem when we will release 1.6. No ETAs