Skip to content

Conversation

@rkaraivanov
Copy link
Member

No description provided.

@rkaraivanov rkaraivanov added enhancement New feature or request mask labels Oct 23, 2025
- Added support for Unicode digits in the mask input parser.
- Updated relevant tests to cover Unicode digit scenarios.
- Parser edge cases handled for better robustness.
- Added more comprehensive test cases for various mask patterns.
@rkaraivanov rkaraivanov requested a review from Copilot November 13, 2025 14:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the mask input component to support Unicode digit normalization, converting digits from various writing systems (Arabic-Indic, Devanagari, Bengali, etc.) to ASCII equivalents (0-9). The implementation replaces a limited IME number conversion with comprehensive Unicode digit support and includes several related improvements.

Key changes:

  • Replaces replaceIMENumbers with replaceUnicodeNumbers supporting 17 digit systems
  • Refactors mask options to separate public and internal interfaces
  • Adds validation to prevent prompt character conflicts with mask flags
  • Fixes navigation logic in getPreviousNonLiteralPosition and getNextNonLiteralPosition

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/components/mask-input/mask-parser.ts Core implementation of Unicode digit normalization, interface refactoring, and navigation fixes
src/components/mask-input/mask-parser.spec.ts Comprehensive test coverage for Unicode digit conversion and edge cases
src/components/mask-input/mask-input-base.ts Adjusts backspace navigation to account for fixed position calculation

}

const MASK_PATTERNS = new Map<string, RegExp>([
['C', /./u], // Any single character
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex /./u matches any character except newlines. The comment claims it matches 'Any single character', but line breaks (\\n, \\r) will not match. If the intention is to truly accept any character including newlines, use /[\\s\\S]/u or /./us (with the s flag). If newlines should be excluded, the comment should clarify this.

Suggested change
['C', /./u], // Any single character
['C', /[\s\S]/u], // Any single character (including newlines)

Copilot uses AI. Check for mistakes.
['#', /[\p{Number}\-+]/u], // Numeric and sign characters (+, -)
['0', /\p{Number}/u], // Numeric (Unicode-aware, converted to ASCII 0-9 during processing)
['9', /[\p{Number}\p{Separator}]/u], // Numeric and separator characters (Unicode-aware)
['#', /[\p{Number}+-]/u], // Numeric and sign characters (+, -)
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern should escape the - character to avoid unintended range interpretation. Use /[\\p{Number}+\\-]/u to explicitly match a literal hyphen-minus character.

Suggested change
['#', /[\p{Number}+-]/u], // Numeric and sign characters (+, -)
['#', /[\p{Number}+\-]/u], // Numeric and sign characters (+, -)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request mask

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants