Skip to content

Fix Tamil nonspacing mark cursor widths - #5216

Open
RamasubbuSK wants to merge 2 commits into
PowerShell:masterfrom
RamasubbuSK:fix/tamil-nonspacing-cursor-width
Open

RamasubbuSK wants to merge 2 commits into
PowerShell:masterfrom
RamasubbuSK:fix/tamil-nonspacing-cursor-width

Conversation

@RamasubbuSK

@RamasubbuSK RamasubbuSK commented Sep 23, 2026 •

Copy link
Copy Markdown

PR Summary

Keep the cursor immediately after Tamil input by treating Tamil nonspacing marks as zero-cell characters. The example in #5215 now measures 21 cells rather than 27.

Fixes #5215.

Changes

  • Return zero width for Tamil anusvara (U+0B82), vowel sign II (U+0BC0), and pulli/virama (U+0BCD). Spacing vowel signs retain their existing one-cell contribution.
  • Keep attached marks when taking cell-limited prefixes/suffixes, including zero-cell budgets and a base that does not fit.
  • Avoid phantom physical lines and double-counted newlines when a mark follows the last cell on a row.
  • Map screen coordinates after attached marks, including intervening ANSI color sequences.
  • Add width, truncation, wrapping, normal-renderer, and screen-reader cursor regressions. The test console models Tamil mark attachment independently using Unicode categories.
  • Update the change log.

Scope and why this is a draft

This is deliberately a scoped Tamil correction, not a general Unicode grapheme implementation. Broadly making every combining mark zero-width would also change existing emoji/variation-selector accounting. ASCII, controls, East Asian width rules, and unrelated Unicode behavior are left unchanged.

It targets the reported Windows Terminal graphemes mode. General grapheme capping, canonically decomposed spacing-vowel combinations, join-control handling, emoji sequences, and terminal measurement-mode negotiation are not solved here. Maintainer feedback on this scope and interactive terminal verification are still needed.

The built module has not replaced the locally installed PSReadLine module.

Verification

Used the repository-pinned .NET SDK 8.0.415, targeting net8.0.

# Run from the test directory
$env:PSREADLINE_TESTRUN = 1
dotnet test --filter "FullyQualifiedName~CellWidthTest|FullyQualifiedName~TamilNonspacing"
  • New regression selection: 34 passed, 3 skipped, 0 failed. The skips are the unavailable French keyboard-layout variants.
  • Independent CellWidthTest run: 28 passed (also verifies that test-runspace initialization does not depend on test order).
  • Full suite: 512 passed, 93 failed, 329 skipped.
  • Untouched upstream baseline at 2984546f62da9f63c31aba965ec3008fcb107024: 478 passed, 93 failed, 326 skipped.
  • Compared failure names: the full-suite failure sets are identical; no additional existing test failures were introduced. The full suite is therefore not claimed green, and those baseline/environment failures remain unresolved.
  • The uploaded Git blobs were compared with the locally tested staged patch and match exactly.

PR Checklist

  • PR has a meaningful, imperative title.
  • Summarized changes and linked the issue.
  • Added regression tests.
  • Complete interactive verification in Windows Terminal, conhost, and VS Code integrated terminal.
  • Updated the change log. No new public API or configuration option is introduced.
Microsoft Reviewers: Open in CodeFlow

RamasubbuSK and others added 2 commits September 23, 2026 15:17
Treat Tamil nonspacing marks as zero-width while preserving spacing vowel signs. Keep attached marks with their bases during truncation, wrapping, and cursor mapping.

Related to PowerShell#5215.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b17b4160-1c66-4f4f-97d0-4582f6173b80
Cover Tamil marks versus spacing vowels, the reported sentence, ANSI-colored text, cell-boundary truncation, wrapped newlines, cursor mappings, and normal/screen-reader rendering. Initialize the shared test runspace for independent width tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b17b4160-1c66-4f4f-97d0-4582f6173b80
@RamasubbuSK

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@RamasubbuSK
RamasubbuSK marked this pull request as ready for review September 24, 2026 02:33
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.

Tamil combining marks are counted as extra cells, placing the input cursor too far right

1 participant