#547 Bug #352: option for aligning block comments in first column

Next_major_release
closed
nobody
None
5
2015-03-12
2014-01-08
No

https://sourceforge.net/p/notepad-plus/bugs/352/
http://sourceforge.net/p/notepad-plus/discussion/331753/thread/1f8ce2b7/

Adds an option under Misc. so that block comments are always aligned in the first column. Apparently Fortran requires this.

So if you choose Edit -> Comment -> Block comment on something indented like this:

          code
          more code
          code

You should get:

C          code
C          more code
C          code

And not:

          C code
          C more code
          C code
1 Attachments

Discussion

  • Loreia2

    Loreia2 - 2014-01-09

    Hi Andreas,

    thanks for taking time to implement this. May I suggest a way to improve this further. I would like to see third option that allows vertical alignment of line comments the way Visual studio does it.

    Here is a short example, Visual studio way:

        //if (_isThemeDirty)
        //{
        //  TCHAR themeFileName[MAX_PATH];
        //  lstrcpy(themeFileName, prevThemeName.c_str());
        //  PathStripPath(themeFileName);
        //  PathRemoveExtension(themeFileName);
        //  int mb_response =
        //      ::MessageBox( _hSelf,
        //          TEXT(" Unsaved changes discarded!\n") 
        //          TEXT(" Do you want to save your changes?"),
        //          themeFileName,
        //          MB_ICONWARNING | MB_YESNO | MB_APPLMODAL);
        //  if ( mb_response == IDYES )
        //      (NppParameters::getInstance())->writeStyles(_lsArray,);
        //}
    

    Notepad++ way:

            // if (_isThemeDirty)
        // {
            // TCHAR themeFileName[MAX_PATH];
            // lstrcpy(themeFileName, prevThemeName.c_str());
            // PathStripPath(themeFileName);
            // PathRemoveExtension(themeFileName);
            // int mb_response =
                // ::MessageBox( _hSelf,
                    // TEXT(" Unsaved changes discarded!\n") 
                    // TEXT(" Do you want to save your changes?"),
                    // themeFileName,
                    // MB_ICONWARNING | MB_YESNO | MB_APPLMODAL);
            // if ( mb_response == IDYES )
                // (NppParameters::getInstance())->writeStyles(_lsArray,);
        // }
    

    You can see that VS aligns vertically, but as far as possible on the right. In order to implement this you need to scan every line of selection in order to determine the shortest amount of white space at the beginning of the line.
    After that appending comment string should be trivial.

    One thing that Visual studio does not handle "properly" is not adding a single space after the comment sign. I am not sure if that should be configurable too? Seems like an overkill to have option like "Add one space after comment".

    BR,
    Loreia

     
  • Don HO

    Don HO - 2014-08-29
    • status: open --> accepted
     
  • Don HO

    Don HO - 2014-08-29

    Thank you Andreas for this patch.

    In order to not overload the GUI, this feature will be applied only on Fortran to fix the bug.

    Don

     
  • Don HO

    Don HO - 2015-03-12
    • Status: accepted --> closed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks