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

Manual indentation of closing lambda bracket is sometimes overridden

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: Qt Creator 4.7.0, Qt Creator 4.8.0-beta2
    • Fix Version/s: None
    • Component/s: C/C++/Obj-C++ Support
    • Labels:
      None
    • Platform/s:
      All

      Description

      I regularly use lambdas inside std-Algorithms. Since the lambda is a parameter of the std-call, I manually indent the opening and closing bracket accordingly:

      std::transform(container.begin(), container.end(),
                     std::back_inserter(target),
                     [](const QString& string)
                     {
                         return string.count();
                     });
      

      Often, the editor later changes the last line, without any action on my side, and without my consent:

      std::transform(container.begin(), container.end(),
                     std::back_inserter(target),
                     [](const QString& string)
                     {
                         return string.count();
      });
      

      The line is also marked "red" as unsaved. Since I wrote the whole block in one go and then saved it, this clearly indicates that the change was made at a later time by the editor.

      I suspect that this happens when I do a refactoring action that creates a new method in the same class.

      Note: I never used the tool to correct indentation (Ctrl-I)

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              kosjar Nikolai Kosjar
              Reporter:
              asperamanca Robert Schimkowitsch
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes