Fortran block comments in Notepad++

Pankrat
2013-08-12
2014-01-09
  • Pankrat
    Pankrat
    2013-08-12

    Could somebody be so kind to comment on the following issue, since I doubt there will be any reaction to my post in the "bug discussion" section:
    https://sourceforge.net/p/notepad-plus/bugs/352/

    So, the problem is the following:
    When block commenting a fortran source file the "C"s are put at the beginning of the text in each line and not at the beginning of the line (pos. 1).

    This has been pointed out long time ago, but I still do not understand how to resolve this. I hope you are not forced to define a new "user defined language" because of this tiny problem. This would be ... at least very strange.

     
  • Pankrat
    Pankrat
    2013-08-13

    Is it a wrong place for this question? I am surprised that nobody reacts with a single word neither to the post here nor to the post in the bug discussion section (link given above). It is hard for me right now to take this discussion forum seriously.

     
  • Loreia2
    Loreia2
    2013-08-14

    Hi Pankrat,

    first you need to determine if this issue has been solved in latest Scintilla.

    Go to http://www.scintilla.org/ and download Scite editor. If you can reproduce this in Scite, than you should open bug report in Scintilla bug tracker.

    If Scite doesn't have this issue, that you must wait until Notepad++ updates Scintilla component. Luckily, work on Scintilla update is ongoing so it shouldn't take long.

    BR,
    Loreia

     
  • Pankrat
    Pankrat
    2013-08-15

    Hi Loreia,

    thanks a lot for your answer.

    I have downloaded SciTE (Version 3.3.4) and I can reproduce the same problem. However in SciTE this problem can be easily solved just by putting the line

    comment.block.at.line.start.fortran=1

    into the file "fortran.properties"

    After that I accidentally found these two things:
    https://sourceforge.net/p/notepad-plus/discussion/331754/thread/8aedacb0/
    https://sourceforge.net/apps/ideatorrent/notepad-plus/ideatorrent/idea/199/

    So my question now is: is there a way to correspondingly change the file "langs.xml" in Notepad++ resulting in the same behavior (block comment at position 1 of a line)? Or is there another way of doing this(not by changing "langs.xml")? At least this issue came up more than 3 years ago. Maybe it has been solved since then.

     
  • Pankrat
    Pankrat
    2013-08-19

    Hi Loreia,

    thanks for your advice. I have tried various things:

    1) I installed the Python Script plugin in Notepod++ and changed the property "initialisation" from "LAZY" to "ATSTARTUP" in the configuration of this plugin. I added the line

    editor.setProperty('comment.block.at.line.start.fortran', '1')

    to the file startup.py. This did not help.

    2) I added the lines

    [Macro name="setExampleProperty" Ctrl="yes" Alt="yes" Shift="no" key="100"]
    [Action type="1" message="4004" wParam="comment.block.at.line.start.fortran" lParam="0" sParam="1"/]
    [/Macro]

    just before [/Macros] in shortcuts.xml. (I replaced some <,> by [,] to make it possible to post it in this forum). Now Ctrl+Alt+NumPad4 should work. This did not help either. (By the way the added lines in shortcuts.xml disappeared after restart of Notepad++).

    3) I used NppExec plugin to execute the line

    sci_sendmsg SCI_SETPROPERTY "comment.block.at.line.start.fortran" "1"

    This did not help either.

    Well, you can imagine I'm not very happy with these results. ;) Somehow it turns out that it is so difficult to do this little thing in an editor which can do thousands of incredibly complicated things. I cannot understand this.

    Maybe I understood something incorrectly on the "How to set up a property" page you have sent me to?

    Any help would be appreciated.

    Regards,
    Pankrat

     
  • Loreia2
    Loreia2
    2013-08-20

    Hi Pankrat,

    at first I thought you must've done something wrong, but then I realized: this is Scite, not Scintilla feature. I've checked N++ source code, and N++ does not support this option.

    So, I did the next best thing, I recompiled a version that aligns line comments. You can download it from here: http://goo.gl/03K4Tl

    I changed just one line of code, in function Notepad_plus::doBlockComment, line 3490:

    lineIndent = _pEditView->execute(SCI_GETLINEINDENTPOSITION, i);
    

    needs to be commented out.
    I think it would be a nice feature of Notepad++ if user could select to align line comments vertically in the first column. In order to have this feature, someone should add this option in Preferences panel. I simply don't have time to do it in foreseeable future.
    Anyone interested in the job?

    All it takes is to add "Align block comments vertically" option into preferences panel, and to save option into XML file when N++ closes.

    And then in doBlockComment add this in line 3490:

    if (alignVertically == false)
        lineIndent = _pEditView->execute(SCI_GETLINEINDENTPOSITION, i);
    

    BR,
    Loreia

     
  • Pankrat
    Pankrat
    2013-08-21

    You are the MAN, Loreia!

    It works!

    I have put notepad2++.exe from your .zip-file to C:\Program Files (x86)\Notepad++\ and renamed it to notepad++.exe in order to use all the old shortcuts. And... yes, it works as long as the new dll(SciLexer2.dll) is in the same folder.

    So, will it be implemented in the next update of Npp? I just do not understand who can do that. Probably there is some limited number of people capable of changing the source code. I think many other users would be very grateful to have this feature. Otherwise I'm afraid the next Npp update will overwrite the .exe-file...

    Once again, Loreia, thanks a lot for your help! I could not imagine there is only one guy answering such kind of questions.

    Best regards,
    Pankrat

     
  • Loreia2
    Loreia2
    2013-08-21

    Hi Pankrat,

    I'm glad to hear it works.
    To answer your question, I don't have time to update main N++ branch right now. Someone else will have to do it. I wrote short instructions in post above. That should be sufficient for anyone willing to dive into this.

    You will have to stick with this version for a while, or change editor and use Scite.

    BR,
    Loreia

     
  • Pankrat
    Pankrat
    2014-01-08

    Hi everybody,

    now, almost half a year after my last request this issue has not been resolved in the current version of Npp. Maybe there is a chance somebody fixes it? This is probably easier than implementing insane features as happened in the recent updates of Npp.

    I just want the block comment symbol (e.g. in fortran files) to be put at the beginning of the line and not at the beginning of the text in this line. That's it!

    Or are you seriously advising to change to another editor due to this small problem?

    Best regards,
    Pankrat

     
  • This is the reality of free software. It is produced by volunteers who don't get paid for their work. They will work on whatever they feel is most fun, not what you consider important.

    But I have submitted a patch for this now ( https://sourceforge.net/p/notepad-plus/patches/547/ ), hopefully it will be accepted by Don.

     
    Last edit: Andreas Jonsson 2014-01-08
  • Pankrat
    Pankrat
    2014-01-09

    Thanks a lot, Andreas!

    I hope very much that this patch will be accepted.

    Of course, one ought to be grateful for people developing such great software like Npp. Nobody can demand anything from free software developers. However, having found this forum with its discussions and bugs sections I assumed that the developers are happy to here how they can improve the program, especially if it takes rather little of a change to the source code.

    So I hope it was at least a bit of a fun for you to implement this block comment alignment feature! Thanks for your time!