Skip to content

fix: unindent multibyte whitespace characters in code blocks#184

Merged
dsherret merged 1 commit into
dprint:mainfrom
ile-24556:fix-182
May 22, 2026
Merged

fix: unindent multibyte whitespace characters in code blocks#184
dsherret merged 1 commit into
dprint:mainfrom
ile-24556:fix-182

Conversation

@ile-24556

Copy link
Copy Markdown
Contributor

Even if multibyte whitespace characters are used, it slices string at character boundaries. So the program does not panic.

This PR closes #182.

@ile-24556 ile-24556 changed the title Unindent multibyte whitespace characters in code blocks fix: unindent multibyte whitespace characters in code blocks May 22, 2026
Whitespace filtered by `is_whitespace()` can be multibyte character,
so we need to slice strings precisely at character boundaries.

Closes dprint#182.

@dsherret dsherret left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@dsherret
dsherret merged commit 125990f into dprint:main May 22, 2026
2 checks passed
@ile-24556
ile-24556 deleted the fix-182 branch May 23, 2026 00:28
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.

bug: Panics on unindent if code block lines indented with multibyte whitespace characters

2 participants