Uploaded image for project: 'Qt Creator'
  1. Qt Creator

Moving code blocks (CTRL+Shift) does not auto indent if first line is a comment line


    • Type: Bug
    • Status: Open
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: Qt Creator 4.8.1, Qt Creator 4.9.0-beta1, Qt Creator 4.9.0-rc1, Qt Creator 4.9.0
    • Fix Version/s: Qt Creator 4.9.0-beta2
    • Labels:
    • Platform/s:
      Linux/X11, Windows


      When moving a code block into a new scope (e.g. if {}) then auto indenting of the code block only works correct, if the first line is not a comment line.


      // example
         if (loadingAreaOK)
         // now let the model use the area progress                // -1
         _wptProgressModel->setAreaProgress(_areaProgress);        // -2

      Mark the two lines (-1 and -2) and use the code move opration in the editor using <CTRL + Shift + Cursor Up> to move the block into the if scope.


      The result should look like this


      // expected result
         if (loadingAreaOK)
            // now let the model use the area progress

      But the result you get is



      // actual result
         if (loadingAreaOK)
         // now let the model use the area progress


      If you swap line -1 and -2 to have the code line above the comment line and move these, the code moving auto indents as expected: the lines are shifted to the indent of the 'if' scope.

      Work around:

      After moving the line press <CTRL>+i to auto indent.

      However it would be nice to check, if the selected lines are not only comment lines and understand the selection as a code block.



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



            • Assignee:
              yvvan Ivan Donchevskii
              moellney Michael Möllney
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes