Bug 1666728 - Qt-Creator: C++14 feature "digit separation" is not handled properly in the Qt-Creator editor
Summary: Qt-Creator: C++14 feature "digit separation" is not handled properly in the Q...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: qt-creator
Version: 29
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Itamar Reis Peixoto
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-16 13:27 UTC by Rolle
Modified: 2019-01-16 13:28 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-01-16 13:28:48 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
incorrect syntax highlighting (16.62 KB, image/png)
2019-01-16 13:27 UTC, Rolle
no flags Details

Description Rolle 2019-01-16 13:27:17 UTC
Created attachment 1521008 [details]
incorrect syntax highlighting

Description of problem:

The C++14 feature "digit separation" is not habndled properly in Qt-Creator editor.

The digit separation means: You can enter in any numeric literals (integer, floating point, binary, ...) the single quote character as often as you like to make it easier for people to read the numeric literals. The editor should eliminate all single quote characters in numeric literals before it compiles.
Legal numeric literals with any single quote characters are for instance (not all are useful, but are allowed :-) ):
2'000
2'000'000
0.000'2
20'0'0
20'0,00'2
0b01'0'1110'110'00

1. Problem:
The syntax highlighting of the Qt-Creator editor switches always the color after a single quote charactor to the "color of comments" and afterwards to "color of a numeric literal", and so on. (see attachment "incorrect syntax highlighting")

2. Problem indention is not working correctly:
It seems that if a source code line has an even number of single quote characters the automatically indention in the next line (after RETURN) will be OK. But if there are an odd number of single quote characters in a source code line the indention in the next line (after RETURN) is incorrect.
Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Here is a simple program:

//--start--
#include <iostream>

int main(int argc, char *argv[])
{
    int x1 = 1000;
    int x2 = 1'000'000;
    int y1 = 1'000;
    int y2 = 1'000'000'000;          //100'000'000

    std::cout << x1 << ", " << x2 << ", " << y1 << ", " << y2 << "\n";

    return 0;
}
//--end--

2. Press "RETURN" after the "int x1 = 1000" line or the
   line "int x2 = 1'000'000;" and the indention is correct
   (number of single quote characters are even)

3. Press "RETURN" after the "int y1 = 1'000" line or the
   line "int y2 = 1'000'000'000;          //100'000'000"
   and the indention is incorrect
   (number of single quote characters are odd; comments counts also!)
   


Actual results:


Expected results:


Additional info:
Qt-Creator 4.8.0 (Windows + Linux), Qt 5.12

Comment 1 Sandro Mani 2019-01-16 13:28:48 UTC
This is not a packaging issue, please report it upstream at https://bugreports.qt.io/projects/QTCREATORBUG/issues


Note You need to log in before you can comment on or make changes to this bug.