Repository navigation
[#7] ISSUE-006: Undo/Redo State Persistence Across Modes - #13
Conversation
Reviewer's GuideImplementationSnapshot the buffer when leaving Insert or Visual mode so edits made in those modes are available to undo afterward.
ConfigurationAdd Takt-specific ignore rules to keep generated or local files out of version control.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Linked issuesChecked at commit 90661b4 #7 ISSUE-006: Undo/Redo State Persistence Across Modes · 1 of 2 met
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/app.rs" line_range="626" />
<code_context>
match key.code {
KeyCode::Esc => {
+ self.buffer.snapshot();
self.mode = Mode::Normal;
self.buffer.clamp_cursor(false);
</code_context>
<issue_to_address>
**Undo skips edits and redo disappears**
When an Insert session ends after an edit, or Visual mode exits without an edit while redo history exists, the exit handlers call `snapshot()` on the current buffer, so `undo()` restores the post-edit state instead of reversing the edit; Visual-mode exits also clear `redo_stack` and add a no-op undo entry. Users see undo fail or redo history disappear.
Remove the unconditional `snapshot()` calls from both mode-exit handlers.
Also at `src/app.rs:661`.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: src/app.rs:626
|
|
||
| match key.code { | ||
| KeyCode::Esc => { | ||
| self.buffer.snapshot(); |
There was a problem hiding this comment.
🟠 High · Undo skips edits and redo disappears
When an Insert session ends after an edit, or Visual mode exits without an edit while redo history exists, the exit handlers call snapshot() on the current buffer, so undo() restores the post-edit state instead of reversing the edit; Visual-mode exits also clear redo_stack and add a no-op undo entry. Users see undo fail or redo history disappear.
Remove the unconditional snapshot() calls from both mode-exit handlers.
Also at src/app.rs:661.
Prompt for AI agents
In `src/app.rs` at line 626:
**Undo skips edits and redo disappears**
When an Insert session ends after an edit, or Visual mode exits without an edit while redo history exists, the exit handlers call `snapshot()` on the current buffer, so `undo()` restores the post-edit state instead of reversing the edit; Visual-mode exits also clear `redo_stack` and add a no-op undo entry. Users see undo fail or redo history disappear.
Remove the unconditional `snapshot()` calls from both mode-exit handlers.
Also at `src/app.rs:661`.
Summary
Issue-006: Undo/Redo State Persistence Across Modes
Problem: The undo/redo stack doesn't properly persist or reset when switching between Normal, Insert, and Visual modes, potentially causing unexpected state.
Evidence:
TextBuffer::undo()andredo()operate onhistoryandredo_stackSuggested Fix:
Execution Report
Workflow
simple-minicompleted successfully.Closes #7
Summary by Sourcery
Preserve editing history when leaving Insert or Visual mode so undo and redo remain consistent across mode changes.
Bug Fixes:
Chores: