Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Fix the behavior of the undo: 'skip' option#282

Merged
maxbrunsfeld merged 3 commits intomasterfrom
mb-ns-fix-undo-skip
Jan 3, 2018
Merged

Fix the behavior of the undo: 'skip' option#282
maxbrunsfeld merged 3 commits intomasterfrom
mb-ns-fix-undo-skip

Conversation

@maxbrunsfeld
Copy link
Copy Markdown
Contributor

This PR changes the behavior of undo after calling .setTextInRange with the {undo: 'skip'} option. Previously, the change would not be added to the undo stack, but this led to an inconsistent state.

Now, when undoing after calling .setTextInRange with {undo: 'skip'}, the change is undone along with the preceding change. Hopefully, this matches the intent of package authors using this option.

We've updated the documentation to discourage using {undo: 'skip'} and instead to call the new method .groupLastChanges after making the change.

Fixes atom/atom#15827

🍐 'd with @nathansobo

This method lets you group the last two changes that you made with
respect to undo and redo.

Signed-off-by: Nathan Sobo <nathan@github.com>
This changes the behavior of undo after calling .setTextInRange with
that option. Previously, the change would not be added to the undo
stack, but this lead to an inconsistent state.

Now, when undoing after calling .setTextInRange with {undo: 'skip'}, the
change is undone along with the preceding change. Hopefully, this
matches the intent of package authors using this option.
Signed-off-by: Nathan Sobo <nathan@github.com>
@maxbrunsfeld maxbrunsfeld merged commit fe11d5a into master Jan 3, 2018
@maxbrunsfeld maxbrunsfeld deleted the mb-ns-fix-undo-skip branch January 3, 2018 20:19
dsandstrom added a commit to dsandstrom/atom-double-tag that referenced this pull request Apr 20, 2018
The option is deprecated
atom/text-buffer#282

They changed the behaviour of the undo option and it no longer works.
This also broke core:redo with this package.  I wasn't able to fix redo,
so this commit is only a partial fix.

Fixes #36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant