Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-32848

Syntax highlighting uses incorrect colors after 2D array initialization

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • Qt Creator 17.0.0
    • Qt Creator 16.0.1
    • C/C++/Obj-C++ Support
    • None
    • Arch Linux
    • Linux/X11
    • 472134a39 (master)

    Description

      When writing the initializer list for a 2D array where one of the sizes is unknown, the syntax highlighting color for keywords changes to the "Attribute" color. For example, when writing the following in a .c or .cpp file:

       

      int foo()
      {
          return 3;
      }
      
      unsigned int test[][2] = {{1, 2}, {3, 4}, {5, 6}};
      
      int bar()
      {
          return 3;
      }

       

      The following is displayed with my current theme:

       

      Notice how the return keyword went from light blue to a greenish-brown, which corresponds to the default value for "Attribute", which I had not modified yet in my custom theme. After changing "Attribute" to white, for example, these values now show white instead. This happens for pretty much every non-type keywords as well as preprocessor directives like #if and #else.

       

      After some experimentation:

      • I can have the initializer list be empty (i.e. {}) and the issue still arises.
      • Putting an explicit size in for the first dimension (4 for this example) avoids the problem.

       

      Attachments

        For Gerrit Dashboard: QTCREATORBUG-32848
        # Subject Branch Project Status CR V

        Activity

          People

            kandeler Christian Kandeler
            akb825 Aaron Barany
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes