Skip to content
New issue

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

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

Already on GitHub? # to your account

change in behaviour of adjacent collapsed spans with inclusiveLeft/inclusiveRight #2629

Closed
jdleesmiller opened this issue Jun 10, 2014 · 1 comment

Comments

@jdleesmiller
Copy link
Contributor

Example -- run this in the console on the CodeMirror home page:

editor.setValue('ab');
spanA = document.createElement('span'); spanA.innerText = 'A';
editor.markText({line: 0, ch: 0}, {line: 0, ch: 1}, {replacedWith: spanA, inclusiveRight: true});
spanB = document.createElement('span'); spanB.innerText = 'B';
editor.markText({line: 0, ch: 1}, {line: 0, ch: 2}, {replacedWith: spanB});

In 3.20, there's no error, and the result is "AB" (with two collapsed spans).

In 3.21 and later, there is an "Inserting collapsed marker partially overlapping an existing one" error in the second markText call.

If the inclusiveRight option is removed, then there's no error in 3.20 or 3.21 and later.

It turns out that we don't absolutely need to use the inclusiveLeft and inclusiveRight options in our application (the rich text mode on writeLaTeX), so we've worked around this by just removing them. But, for future reference, is the new behaviour the intended one?

@marijnh
Copy link
Member

marijnh commented Jun 23, 2014

That was a bug. Attached patch should help.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants