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

Grouped undo not updating marker ranges - #52

Merged
nathansobo merged 4 commits into
masterfrom
ks-grouped-undo-marker-updates
Mar 17, 2015
Merged

nathansobo merged 4 commits into
masterfrom
ks-grouped-undo-marker-updates

Conversation

@kevinsawicki

Copy link
Copy Markdown
Contributor

Looks like grouped undo isn't properly updating marker ranges as shown in the test case attached to this PR.

This came about from reducing atom/bracket-matcher#110 which I believe will be fixed by fixing the test case here.

The basic problem is that marker ranges aren't getting updated on undo operations causing the marker range to be past the end of the buffer which is causing various issues in Atom since it allows cursors/selections to exceed the buffer's range.

/cc @maxbrunsfeld @nathansobo

@kevinsawicki kevinsawicki changed the title Grouped undo updates markers incorrectly Grouped undo not updating marker ranges Mar 17, 2015
kevinsawicki and others added 4 commits March 17, 2015 15:41
Previously, we attempted to associate patches for all markers with every
buffer patch. Now, we allow the application of buffer patches to update
markers directly. When undoing or redoing a transaction, we additionally
restore all markers to the state they had when the transaction was
constructed.
@nathansobo
nathansobo force-pushed the ks-grouped-undo-marker-updates branch from b8a6265 to aae157c Compare March 17, 2015 22:25
@nathansobo

Copy link
Copy Markdown
Contributor

This didn't have anything to do with time based grouping, but it was a problem with restoring marker state after undoing transactions. Our existing approach made no sense. We've updated the behavior to always record the state of all markers at the start of a transaction so it can be restored afterward.

It's a pretty big change that could have some subtle implications for packages... here's what will be slightly different:

Basically, when handling an undo event for a text change, the state of markers will reflect that change. Then there could be a subsequent marker update event that restores them to their original state when the transaction finishes being undone. Everything is still technically correct and as long as authors are observing marker changes there should be no problem. However, some marginal use cases could encounter issues. We'll run the bundled package specs before upgrading to make sure we're at least clear on our side. It's worth watching out for over the coming days

/cc @izuzak (We can do a hangout to explain this better if that paragraph wasn't clear. It's kinda hard to explain this)

nathansobo pushed a commit that referenced this pull request Mar 17, 2015
Grouped undo not updating marker ranges
@nathansobo
nathansobo merged commit 1c047a2 into master Mar 17, 2015
@nathansobo
nathansobo deleted the ks-grouped-undo-marker-updates branch March 17, 2015 22:30
@kevinsawicki

Copy link
Copy Markdown
Contributor Author

This didn't have anything to do with time based grouping

Oh interesting, I could only reproduce it when using transactions (both in Atom, and in specs)

@nathansobo

Copy link
Copy Markdown
Contributor

@kevinsawicki We're just going to push this to master and fight the 🔥 if there is one. It's too hard to do anything else with semver. We'll test core locally first.

@kevinsawicki

Copy link
Copy Markdown
Contributor Author

Could you hold off on publishing until I get atom/atom#6011 merged?

Sorry, just want to power through any pathwatcher weirdness with that upgrade.

@nathansobo

Copy link
Copy Markdown
Contributor

Ended up undoing this merge... it was premature. Will open another PR and reference this one soon.

@nathansobo
nathansobo restored the ks-grouped-undo-marker-updates branch March 17, 2015 23:10
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.

2 participants