regular-express
regular-express copied to clipboard
Extra undo seems to delete redo history
In the web demo: https://regular.express/
Typing 1 letter and then doing undo-redo works. But with an additional undo after we have nothing to undo, it seems to delete the redo stack, so undo-undo-redo does not redo the letter
This happened on firefox nightly, did not test other browsers but I imagine it reproduces
I digged a bit, findings:
The redo stack seems to be getting cleared here: https://github.com/bvisness/regular-express/blob/837a58c4351d63711b0c31c627863c996bb090fd/src/undo.c#L81
I think:
- there is a weird undo at the bottom of the undo stack that changes CursorIndex (to 5 which seems out of bounds, I'm talking about the default Hello string in the demo)
- after that is undone, something sets it back to 4 before undo_commit
- we reach undo_commit() and the undo lib thinks there was an input to change the 5 to 4, so it clears the redo stack