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

Manual indentation of closing lambda bracket is sometimes overridden

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P3: Somewhat important
    • None
    • Qt Creator 4.7.0, Qt Creator 4.8.0-beta2
    • C/C++/Obj-C++ Support
    • None
    • 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

            kandeler Christian Kandeler
            asperamanca Robert Schimkowitsch
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes