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

Indentation jumps to right when editing generates invalid code

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • None
    • Qt Creator 13.0.0
    • None
    • All
    • c14845181 (master)

    Description

      Consider the following code (cursor is marked with `|`):

      typedef struct S {
          int i;
          long l;
          float f;
          double d;
      } S;
      
      int main()
      {
          S s = {.i = 1|, .l = 2, .f = 3, .d = 4};
      
          return s.i;
      }
      

      I want to change the line to

      S s = {.i = 1}; //, .l = 2, .f = 3, .d = 4};
      

      so I press `}` and immediately the whole code is indented two times (see attached video).

      This also happens with `-tcs`, but I think depending on tab settings and previous/next lines the indentation can be much higher.

      The indentation is corrected once `;` is pressed but the effect is really annoying and makes you think you did something wrong.

      Attachments

        Issue Links

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

          Activity

            People

              artem.sokolovskii Artem Sokolovskii (Inactive)
              aha_1980 André Hartmann
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes