Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 4.10.1
-
None
-
-
efa9d258a267f42234bfc30293f2b8eae702166e (qt-creator/qt-creator/master)
Description
I have bound the action ClangFormat > FormatAtCursor to a keyboard shortcut which I often use to format code while editing.
The problem is when the text beforce the cursor contains umlauts the wrong text is formatted.
example.cpp
int main() { int a1 ; int a2 ; int a3 ; int a4 ; // ääääääääääääääääääää int a5 ; int a6 ; int a7 ; int a8 ; int a9 ; }
When I position the cursor before a8, the lines containing a6 and a7 are formatted.
The problem is, that ClangFormat::formatAtCursor() forwards the wrong offset to clang-format.
The offset is the character position, but clang-format expect the position in bytes.
Perhaps not directly related, but If I add the character '���' at the beginning of the document it even deletes text, which doesn't happen when I invoke clang-format from the command-line:
// ��� int main() { int a1 ; it a2 ; it a3 ; it a4 ; / ääääääääääääääääääää int a5 ; it a6 ; it a7 ; it a8 ; int a9 ; }
Attachments
For Gerrit Dashboard: QTCREATORBUG-23131 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
315794,3 | Pass the correct positions to clang-format | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |