Skip to content

Support repeatedly inserting at the same position.#5

Merged
Rich-Harris merged 2 commits intoRich-Harris:masterfrom
eventualbuddha:insert-at-same-position-fails
Jan 15, 2015
Merged

Support repeatedly inserting at the same position.#5
Rich-Harris merged 2 commits intoRich-Harris:masterfrom
eventualbuddha:insert-at-same-position-fails

Conversation

@eventualbuddha
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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