Skip to content

Fix misaligned error pointer for full-width characters - #1627

Open
yashasvi-srivastava21 wants to merge 3 commits into
lark-parser:masterfrom
yashasvi-srivastava21:yashasvi-srivastava21-patch-1
Open

Fix misaligned error pointer for full-width characters#1627
yashasvi-srivastava21 wants to merge 3 commits into
lark-parser:masterfrom
yashasvi-srivastava21:yashasvi-srivastava21-patch-1

Conversation

@yashasvi-srivastava21

Copy link
Copy Markdown

Fixes #1530

get_context() pads the ^ error pointer using one regular space
per preceding character. This assumes every character has the same
visual width, which breaks down for full-width (CJK) characters,
causing the pointer to land on the wrong column.

This PR adds a _padding_for() helper that checks each character's
Unicode east-asian-width property and substitutes a full-width space
(U+3000) for wide/full-width characters, keeping the pointer aligned
regardless of character width.

@erezsh

erezsh commented Jul 25, 2026

Copy link
Copy Markdown
Member

This PR already tried solving it, but didn't finish: #1593

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.

Misaligned error location when input text contain full-width characters

2 participants