Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save an undo checkpoint before paste in insert mode #8121

Conversation

the-mikedavis
Copy link
Member

I often paste and find out that my clipboard didn't have what I expected on it. Previously, undoing the change (u in normal mode) would also undo everything else I added in insert mode which is usually too much.

@the-mikedavis the-mikedavis added C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much S-waiting-on-review Status: Awaiting review from a maintainer. labels Aug 30, 2023
pascalkuthe
pascalkuthe previously approved these changes Aug 30, 2023
Copy link
Member

@pascalkuthe pascalkuthe left a comment

Choose a reason for hiding this comment

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

I agree with this 👍 Should we also do the same thing for the various paste commands in insert mode? It would seem odd if bracketed paste does this but a cumst binding like a-v wouldn't

@the-mikedavis
Copy link
Member Author

Yeah we could do this in helix_term::commands::paste_impl so it works for all paste commands in insert mode 👍. Pastes from other registers should be fine to have undo checkpoints for too (maybe you hit the wrong register before pasting with C-r for example).

@the-mikedavis the-mikedavis force-pushed the md-history-checkpoint-before-bracketed-paste branch from 6c119f0 to 1657aec Compare August 30, 2023 21:04
@the-mikedavis the-mikedavis changed the title Save an undo checkpoint before bracketed paste in insert mode Save an undo checkpoint before paste in insert mode Aug 30, 2023
Copy link
Member

@pascalkuthe pascalkuthe left a comment

Choose a reason for hiding this comment

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

A I keep forgetting about c-r, even tough it's such a nice binding 😅 Considering that c-r is a default binding it makes even more sense to create a checkpoint here 👍

@archseer
Copy link
Member

Somewhat related to #7226 ? Should merge both in tandem

@the-mikedavis
Copy link
Member Author

Not exactly, this one only has to do with insert mode behavior rather than mode switching, similar to #7747.

I've been meaning to take a look at #7226 and figure out what's going on in the mode-switching though, I'll give that a look soonish

@pascalkuthe
Copy link
Member

e2a8774 from that PR is actually almost the same as the original version of this PR I think?

The changes to :write are probably orthogonal

@the-mikedavis
Copy link
Member Author

Ah yeah actually I didn't notice that part. That part could be dropped after this change. It's saving after the paste which is a little different behavior-wise. I believe we want to save before the paste though not after.

@the-mikedavis the-mikedavis merged commit 59b020e into helix-editor:master Nov 20, 2024
@the-mikedavis the-mikedavis deleted the md-history-checkpoint-before-bracketed-paste branch November 20, 2024 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants