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

Selection is sometimes not merged correctly #10628

Closed
psmyrek opened this issue Oct 1, 2021 · 0 comments · Fixed by #10656
Closed

Selection is sometimes not merged correctly #10628

psmyrek opened this issue Oct 1, 2021 · 0 comments · Fixed by #10656
Assignees
Labels
browser:firefox package:engine squad:core Issue to be handled by the Core team. squad:features Issue to be handled by the Features team. type:bug This issue reports a buggy (incorrect) behavior.

Comments

@psmyrek
Copy link
Contributor

psmyrek commented Oct 1, 2021

📝 Provide detailed reproduction steps (if any)

Similar case originally reported in https://github.com/cksource/ckeditor5-internal/pull/1006#issuecomment-931116656.

The mergeIntersectingRanges() function in packages/ckeditor5-engine/src/model/utils/selection-post-fixer.js does not work as expected in some cases using Firefox.

Let's assume the following:

  1. We have 3 ranges to merge in the following order: A, B and C.

  2. The A range is not intersecting with the B range.

  3. The C range is intersecting with A and B.

      └── A ──┘  └── B ──┘
    └───────── C ──────────┘
    
  4. The mergeIntersectingRanges() function returns incorrectly 2 ranges: A and B + C, because it checks only the previous range and not all previously handled ranges, as it should.

✔️ Expected result

The expected result is one merged range A + B + C.

❌ Actual result

Currently, this function returns 2 ranges: A and B + C, but the A range is intersecting with B + C (because C is intersecting with A as I described in the preconditions).

❓ Possible solution

This function should check all already handled ranges and not only the previous one.

📃 Other details

  • Browser: Firefox

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@psmyrek psmyrek added type:bug This issue reports a buggy (incorrect) behavior. browser:firefox squad:features Issue to be handled by the Features team. labels Oct 1, 2021
@mlewand mlewand added this to the iteration 48 milestone Oct 4, 2021
@mlewand mlewand modified the milestones: iteration 48, iteration 49 Oct 25, 2021
@Reinmar Reinmar added squad:core Issue to be handled by the Core team. and removed squad:features Issue to be handled by the Features team. labels Nov 16, 2021
@Reinmar Reinmar removed this from the iteration 49 milestone Nov 16, 2021
@Reinmar Reinmar added the squad:features Issue to be handled by the Features team. label Nov 16, 2021
@Reinmar Reinmar added this to the iteration 49 milestone Nov 16, 2021
arkflpc added a commit that referenced this issue Nov 16, 2021
…merge-ranges

Fix (engine): Merge intersecting ranges that aren't adjacent to each other on ranges array. Closes #10628.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser:firefox package:engine squad:core Issue to be handled by the Core team. squad:features Issue to be handled by the Features team. type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants