<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - ColumnLimit check for trailing comments alignment acts wrong for multi-byte UTF-8"
href="https://bugs.llvm.org/show_bug.cgi?id=48280">48280</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ColumnLimit check for trailing comments alignment acts wrong for multi-byte UTF-8
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Formatter
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>seroburomalinovyi@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>.clang-format:
AlignTrailingComments: true
ColumnLimit: 80
What we have upon clang-format:
int a_short; // some 1-byte UTF8 comment with some good and neat info
int a_veryverylong; // some one-byte UTF8 comment breaks correctly at 80 char
// boundary
int a_short_rus; // А теперь комментарии, например, на русском, 2-байта
int a_veryverylong_rus; // Верхний коммент еще не превысил границу в 80,
однако
// уже отодвинут. Перенос, при этом, отрабатывает
верно
-------------
What we should have:
int a_short; // some 1-byte UTF8 comment with some good info
int a_veryverylong; // some one-byte UTF8 comment breaks correctly at 80 char
// boundary
int a_short_rus; // А теперь комментарии, например, на русском, 2-байта
int a_veryverylong_rus; // Верхний коммент еще не превысил границу в 80,
однако
// уже отодвинут. Перенос, при этом, отрабатывает
верно
-------------
Russian trailing comments go as UTF-8 2-byte characters, and, obviously,
clang-format counts their length as raw byte count when checking if line is
exceeded. As a result, comments fall back closer to code, while still having
enough space for being aligned.
This is relevant only for trailing comment alignment tirgger check. Line break
upon exceeding 80 character limit works correctly for multi-byte characters.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>