Skip to content

Fix undo grouping of backspacing - #590

Merged
Leonard Hecker (lhecker) merged 1 commit into
mainfrom
dev/lhecker/backspace-grouping
Aug 4, 2025
Merged

Leonard Hecker (lhecker) merged 1 commit into
mainfrom
dev/lhecker/backspace-grouping

Conversation

@lhecker

Copy link
Copy Markdown
Member

This regressed in 091b742.

Comment thread src/buffer/mod.rs
// If both the last and this are a Write/Delete operation, we skip allocating a new undo history item.
if cursor_before.offset != cursor.offset
|| history_type != self.last_history_type
if history_type != self.last_history_type

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm is there a risk in removing this check

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if the self.cursor moves without the last_history_type being reset to "other" would break this because it would group unrelated writes/deletes.

However, the commit that introduced this in the first place does make sure to reset the last_history_type from what I can tell, so this is fine.

@lhecker
Leonard Hecker (lhecker) merged commit 4f4d093 into main Aug 4, 2025
@lhecker
Leonard Hecker (lhecker) deleted the dev/lhecker/backspace-grouping branch August 4, 2025 20:32
Lou32 (Lou32Verbose) pushed a commit to Lou32Verbose/edit that referenced this pull request Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants