Skip to content

Add regression tests for VS16 after zero-width chars in split_graphemes#4007

Merged
willmcgugan merged 2 commits intomasterfrom
copilot/sub-pr-4006
Feb 19, 2026
Merged

Add regression tests for VS16 after zero-width chars in split_graphemes#4007
willmcgugan merged 2 commits intomasterfrom
copilot/sub-pr-4006

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

AI?

  • AI was used to generate this PR

AI generated PRs may be accepted, but only if @willmcgugan has responded on an issue or discussion.

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate (see note about typos above).
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

Addresses missing regression coverage for #4006's infinite loop fix in split_graphemes. When VS16 (\ufe0f) follows a zero-width character that never sets last_measured_character (e.g. escape \x1b or ZWJ \u200d), the old code would skip the elif last_measured_character: branch entirely, leaving index unadvanced and causing an infinite loop. The fix (merging the else branch) was already in place; this PR adds the tests to lock it in.

New parametrized cases in test_split_graphemes:

  • "\x1b\ufe0f" — VS16 after escape → [(0, 2, 0)], width 0
  • "\u200d\ufe0f" — VS16 after ZWJ → [(0, 2, 0)], width 0

Part of #4006.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] WIP address feedback on infinite loop fix Add regression tests for VS16 after zero-width chars in split_graphemes Feb 19, 2026
Copilot AI requested a review from willmcgugan February 19, 2026 16:54
Base automatically changed from fix-grapheme-stuck to master February 19, 2026 17:04
@willmcgugan willmcgugan marked this pull request as ready for review February 19, 2026 17:06
@willmcgugan willmcgugan merged commit f54bfe0 into master Feb 19, 2026
20 of 22 checks passed
@willmcgugan willmcgugan deleted the copilot/sub-pr-4006 branch February 19, 2026 17:06
@codecov-commenter
Copy link

codecov-commenter commented Feb 19, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.87%. Comparing base (87e7ca2) to head (f07a3fc).
⚠️ Report is 7 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4007   +/-   ##
=======================================
  Coverage   97.87%   97.87%           
=======================================
  Files          96       96           
  Lines        8370     8370           
=======================================
  Hits         8192     8192           
  Misses        178      178           
Flag Coverage Δ
unittests 97.87% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

3 participants