fix (checks): Handle overlapping non-nested higlights#19507
Merged
Conversation
nijel
reviewed
May 12, 2026
6b1cd47 to
36cde11
Compare
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes highlighting span handling to correctly deal with partially overlapping (non-nested) highlight ranges, avoiding broken highlight rendering/replacement behavior when multiple checks/flags match intersecting spans.
Changes:
- Added
merge_highlight_spans()utility and switchedhighlight_string()to merge overlaps into union spans. - Updated placeholder check highlighting to collect matches per-flag/pattern and merge overlaps.
- Adjusted
replace_highlighted()to advancelast_endacross overlaps, and added regression tests + changelog entry.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
weblate/checks/utils.py |
Introduces span-union merging and uses it for highlight_string(); tweaks overlap handling in replace_highlighted(). |
weblate/checks/placeholders.py |
Updates placeholder highlighting to merge overlaps across multiple placeholder patterns/flags. |
weblate/checks/tests/test_utils.py |
Adds a regression test for partially overlapping (non-nested) highlights. |
weblate/checks/tests/test_placeholders.py |
Adds a regression test covering overlapping placeholder patterns. |
docs/changes.rst |
Documents the changed placeholder highlighting behavior for the 2026.5 changelog. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
for more information, see https://pre-commit.ci
auto-merge was automatically disabled
May 13, 2026 06:16
Head branch was pushed to by a user without write access
Member
|
Merged, thanks for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I wasn't able to find real world examples yet, but the logic should cover those
I've started a conversation here hoping to get some feedback from the community