https://bugs.kde.org/show_bug.cgi?id=418918

            Bug ID: 418918
           Summary: Comments by shortcut do not follow the indentation
                    rule
           Product: kate
           Version: Git
          Platform: Compiled Sources
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: indentation
          Assignee: kwrite-bugs-n...@kde.org
          Reporter: kogiokkaf...@gmail.com
  Target Milestone: ---

SUMMARY
The starting point of comment syntax should be right after the indentation of
the commented line. Currently Kate's comment shortcut (Ctrl+/) puts the comment
syntax at the very beginning of the line, without regard to the indentation.

This bug will cause auto-formatting tools like clang-format to indent the
commented line once again.

STEPS TO REPRODUCE
1. Example code:
main.cc
----
#include <iostream>
int
main()
{
  std::cout << "Hello World!" << std::endl;
  {
    std::cout << "Hello World!" << std::endl;
    {
      std::cout << "Hello World!" << std::endl;
    }
  }
}
----

2. Press Ctrl+/ to comment the hello-worlds.


OBSERVED RESULT

Indentations by Ctrl+/
<main.cc>
----
#include <iostream>
int
main()
{
//   std::cout << "Hello World!" << std::endl;
  {
//     std::cout << "Hello World!" << std::endl;
    {
//       std::cout << "Hello World!" << std::endl;
    }
  }
}
----

Result from "clang-format --style=Mozilla main.cc":
<main.cc>
----
#include <iostream>
int
main()
{
  //   std::cout << "Hello World!" << std::endl;
  {
    //     std::cout << "Hello World!" << std::endl;
    {
      //       std::cout << "Hello World!" << std::endl;
    }
  }
}
----


EXPECTED RESULT

Comments in respect of indentations:
<main.cc>
----
#include <iostream>
int
main()
{
  // std::cout << "Hello World!" << std::endl;
  {
    // std::cout << "Hello World!" << std::endl;
    {
      // std::cout << "Hello World!" << std::endl;
    }
  }
}
----

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.67.0 
Qt Version: 5.13.2

ADDITIONAL INFORMATION
None

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to