Repository navigation
fix(ui-egui): typing after an undo starts a new history step (#160) - #183
Merged
DWAA1660 merged 1 commit intoNov 12, 2026
Merged
Conversation
`History::record` dropped the redo steps and then let new typing fold into the step it was on. After an Undo, that is the state Undo had just restored: typing in the same block within the pause replaced it, so the next Undo went past it and the restored state was lost (AlienTechSoftware#160). A step recorded while there were redo steps now always starts a new step. Ordinary runs of typing still fold into one. Fixes AlienTechSoftware#160 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Fixes #160.
history::History::recordtruncated the redo steps and then calledfolds_into_last. That merges typing into the current step when it's the sameKind::Typing(block)within the 700 ms pause. Straight after an Undo, the current step is the state Undo had just restored. Typing then overwrote it in place, and the next Undo skipped past it. In the issue's sequence, typingabc, an edit, Undo, thenXwithin the window, the final Undo returned""instead of"abc".recordnow notes whether there were redo steps (at + 1 < steps.len()) before truncating them. If there were, the user branched from an Undo and the new step never folds. It becomes a step of its own after the restored state. Contiguous typing with no Undo in between still coalesces as before.How it was checked
history::tests::typing_after_an_undo_is_a_step_of_its_own:X, Undo returnsabc, then"". Redo walks forward throughabc→abcXon the new branch and stops.""instead ofabc), and passes with itcargo test -p notecraft-ui-egui: all pass (303 unit, 202 UI)cargo fmt --all -- --check,cargo clippy -p notecraft-ui-egui --all-targets -- -D warnings: clean🤖 Generated with Claude Code