Skip to content

Fix: named captures indexed incorrectly in multimatches with special line types#8748

Merged
vadi2 merged 1 commit intoMudlet:developmentfrom
ehussong:fix/multimatches-named-captures-indexing
Jan 6, 2026
Merged

Fix: named captures indexed incorrectly in multimatches with special line types#8748
vadi2 merged 1 commit intoMudlet:developmentfrom
ehussong:fix/multimatches-named-captures-indexing

Conversation

@ehussong
Copy link
Copy Markdown
Contributor

@ehussong ehussong commented Jan 4, 2026

Summary

  • Fixes named capture groups being placed in wrong regex index in multimatches when multiline triggers use special line types (like line spacers)
  • Root cause: nameCaptures vector not staying synchronized with multiCaptureList

Changes

  1. match_line_spacer(): Add empty nameCaptures entry when line spacer matches
  2. updateMultistates(): Add else clause to push empty nameCaptures when nameMatches is null for non-first pattern conditions

Test plan

  • Build succeeds
  • All 18 unit tests pass
  • Manual test with reproduction trigger from issue:
    • Create multiline trigger with: regex pattern, line spacer, regex with named capture
    • Verify named captures appear in correct multimatches[n] index

Fixes #7989

🤖 Generated with Claude Code

…line types

When multiline triggers use special line types like line spacers, named
capture groups were placed in the wrong regex index in the multimatches
table. This was caused by the nameCaptures vector not staying synchronized
with multiCaptureList.

Two fixes:
1. match_line_spacer(): Add empty nameCaptures entry when line spacer matches
2. updateMultistates(): Add else clause to push empty nameCaptures when
   nameMatches is null for non-first pattern conditions

Fixes Mudlet#7989

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ehussong ehussong requested a review from a team as a code owner January 4, 2026 23:07
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Jan 4, 2026

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@vadi2 vadi2 merged commit 9fc4be8 into Mudlet:development Jan 6, 2026
15 checks passed
vadi2 pushed a commit that referenced this pull request Feb 3, 2026
…line types (#8748)

## Summary
- Fixes named capture groups being placed in wrong regex index in
`multimatches` when multiline triggers use special line types (like line
spacers)
- Root cause: `nameCaptures` vector not staying synchronized with
`multiCaptureList`

## Changes
1. `match_line_spacer()`: Add empty `nameCaptures` entry when line
spacer matches
2. `updateMultistates()`: Add else clause to push empty `nameCaptures`
when `nameMatches` is null for non-first pattern conditions

## Test plan
- [x] Build succeeds
- [x] All 18 unit tests pass
- [x] Manual test with reproduction trigger from issue:
- Create multiline trigger with: regex pattern, line spacer, regex with
named capture
  - Verify named captures appear in correct `multimatches[n]` index

Fixes #7989

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 9fc4be8)
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.

Named matches are stored incorrectly in multimatches when special line types are used

2 participants