I am about current folding for Fortran.
For example, for the code
if (a > b) then
print *, 'Hi'
else
print *, 'Hello'
endif'
the current implementation of the folding makes so, that after folding 'if' statement, the code until 'endif' is hidden, like
if (a > b) then
----------------------
I think, it is not the best solution, because it hides the logic. I would expect, that the code between 'if' and 'else' would be hidden only, like:
if (a > b) then
-------------------------
else
print *, 'Hello'
endif'
For example, such type of folding is for Python (in C++ it depends on how '{ }' are used)
(I have attached a screen-shot to understand better what I mean.)
If you would agree, I could try to implement required changes in Fortran folding.
screenshot
See the implementation of fold.at.else in the C++ lexer for an example of this. A good implementation of this for Fortran may be included. I won't be working on it myself.
Hello Neil,
I have implemented required changes in LexFortran.cxx file to improve folding in Fortran. The changes are tested on my custom CodeBlocks IDE build (darmar.vgtu.lt) and I haven't received any complains about it from users. So, I hope, there are no bugs left.
Besides, the attached patch fixes bug related to folding, when WHERE statement in fixed-form source file is used.
Indentation should match existing code by using tabs instead of spaces.
The test here is pointless:
if (isPrevLine)
isPrevLine = false;
Thank you, Neil, for your response.
I think, that the problem with 'tabs' is that the current highlighting for Fortran77 doesn't support 'tab-based' source code. As a result, the folding is wrong (same as highlighting). 'Tab-based' source code highlighting was never implemented in Scientilla. If I am wrong, maybe you have an example with source code, which causes the problem you mentioned?
About:
if (isPrevLine)
isPrevLine = false;
Sorry, but I don't understand, why you think it is pointless?
The spaces are in your C++ code "fortran_lexer.patch".
The code
has identical effects to
I have modified the patch (file is attached).
If you have more comments, I am ready to make changes again.
That patch is still using lines with indentation containing spaces.
Sorry, I forgot to change the spaces to the tabs.
Now, should be OK.
Committed as [75999d] along with indentation normalization in [f5e8ce].
Related
Commit: [75999d]
Commit: [f5e8ce]
Thank you, Neil.
Darius