StyLua icon indicating copy to clipboard operation
StyLua copied to clipboard

Incorrect computation of line width with multibyte characters

Open echasnovski opened this issue 3 years ago • 2 comments

  1. Create a file with line string.rep("ыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыы", 10).
  2. Run stylua with default config on that file. It results into multi line function call, but line width is only 70 characters, but 122 bytes.

Version: 0.14.3.

echasnovski avatar Sep 16 '22 12:09 echasnovski

Wherever we do .len() on a string we should probably compute graphemes. Will probably need to bring in an external crate for this

JohnnyMorganz avatar Sep 16 '22 14:09 JohnnyMorganz

Yeah... I feel you. Multibyte characters are a constant source of trouble.

echasnovski avatar Sep 16 '22 14:09 echasnovski