Repository navigation
fix: keep oversized deletions within valid undo positions - #126
Open
PerchAnton wants to merge 1 commit into
Open
PerchAnton wants to merge 1 commit into
PerchAnton wants to merge 1 commit into
Conversation
This was referenced Oct 25, 2026
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.
Deleting past the end of a buffer could record a one-past-the-last row in undo history. Ctrl+U then restores that invalid cursor and panics. An empty delete also created a history entry and discarded redo.
Resolve an oversized deletion's endpoint to the actual final character before recording history. Return false for an empty range, preserving redo. Add four regression tests and extend the existing deletion matrix to check cursor validity after undo and the documented no-op return value.
Related: #121. The problem also reproduces without select_all, including a Unicode multiline buffer. This fixes the recorded endpoint rather than clamping an invalid cursor after undo.
Validation on Rust 1.99.1/macOS arm64:
The delete-chunk history path also uses next_back instead of last to keep current stable Clippy clean; it retrieves the same final drained line. GitHub reports no native workflow runs/checks for this PR or its fork yet; the passing external adapter job does not substitute for the full native CI matrix.