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

Support repeatedly inserting at the same position. #5

Merged
merged 2 commits into from
Jan 15, 2015
Merged

Support repeatedly inserting at the same position. #5

merged 2 commits into from
Jan 15, 2015

Conversation

eventualbuddha
Copy link
Contributor

It seems that inserting at the same position multiple times can cause parts of the string to duplicate. The example in this commit is given ab and inserting 1 between a and b, followed by inserting 2 at the same position, yields a121b instead of the expected a21b.

@eventualbuddha
Copy link
Contributor Author

Just added a commit that fixes the issue by handling inserts as distinct from replacements. I've confirmed this fixes the issue in the original project where I found the bug. It also adds an assertion in #replace to ensure that this kind of thing cannot silently corrupt the data again.

@eventualbuddha eventualbuddha changed the title Add a failing test for repeatedly inserting at the same position. Support repeatedly inserting at the same position. Jan 15, 2015
Rich-Harris added a commit that referenced this pull request Jan 15, 2015
Support repeatedly inserting at the same position.
@Rich-Harris Rich-Harris merged commit f8f7e5b into Rich-Harris:master Jan 15, 2015
@Rich-Harris
Copy link
Owner

Excellent, many thanks - released 0.3.1

@eventualbuddha eventualbuddha deleted the insert-at-same-position-fails branch January 15, 2015 16:03
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