Skip to content

Make paste a separate undo transaction from preceding edits#52003

Merged
Veykril merged 1 commit intomainfrom
push-pwxxmrsxxmky
Mar 30, 2026
Merged

Make paste a separate undo transaction from preceding edits#52003
Veykril merged 1 commit intomainfrom
push-pwxxmrsxxmky

Conversation

@Veykril
Copy link
Copy Markdown
Member

@Veykril Veykril commented Mar 20, 2026

When undoing a paste, it is really confusing when that actually also removes what was type right before the paste if the paste happened fast enough after.

Release Notes:

  • Fixed undoing a paste sometimes also undoing edits right before the paste

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 20, 2026
@zed-codeowner-coordinator zed-codeowner-coordinator bot requested review from a team, dinocosta and osiewicz and removed request for a team March 20, 2026 10:44
@zed-community-bot zed-community-bot bot added the staff Pull requests authored by a current member of Zed staff label Mar 20, 2026
Copy link
Copy Markdown
Member

@dinocosta dinocosta left a comment

Choose a reason for hiding this comment

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

Hey @Veykril, sorry for being late reviewing this! I’d gotten used to being assigned to ‎staff PRs without having to explicitly approve them 😅

The change makes sense to me, but I’ve confirmed that the test still passes if the ‎self.finalize_last_transaction call is commented out. Looking into this a bit, it seems related to ‎text::History::group_interval, which is set to ‎0 in tests, meaning that no edits are ever grouped. As a result, it seems that we never end up, in tests, in a situation where undoing would remove both the paste and the inserted text. We probably need to call ‎Buffer::set_group_interval with a sensible value that will actually exercise this test.

Let me know what you think. Thanks!

@Veykril
Copy link
Copy Markdown
Member Author

Veykril commented Mar 30, 2026

Oh thanks for double checking the test

@Veykril Veykril force-pushed the push-pwxxmrsxxmky branch from cfd2982 to 88fdfc9 Compare March 30, 2026 07:02
@Veykril Veykril enabled auto-merge (squash) March 30, 2026 07:02
@Veykril Veykril force-pushed the push-pwxxmrsxxmky branch from 88fdfc9 to b88f30a Compare March 30, 2026 07:05
@Veykril Veykril force-pushed the push-pwxxmrsxxmky branch from b88f30a to 8e549ee Compare March 30, 2026 07:05
@Veykril
Copy link
Copy Markdown
Member Author

Veykril commented Mar 30, 2026

/cherry-pick preview

@Veykril Veykril merged commit 8cbcadf into main Mar 30, 2026
30 checks passed
@Veykril Veykril deleted the push-pwxxmrsxxmky branch March 30, 2026 07:17
@zed-zippy
Copy link
Copy Markdown
Contributor

zed-zippy bot commented Mar 30, 2026

🍒💥 Cherry-pick did not succeed
https://github.com/zed-industries/zed/actions/runs/23732653126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants