Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 390322 - Photran Block Comment ==> Comment / uncommenting differently
Summary: Photran Block Comment ==> Comment / uncommenting differently
Status: RESOLVED FIXED
Alias: None
Product: PTP
Classification: Tools
Component: Photran.Editor & Outline View (show other bugs)
Version: 8.0.2   Edit
Hardware: All Linux
: P3 major (vote)
Target Milestone: 8.1   Edit
Assignee: Jeffrey Overbey CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-25 06:40 EDT by Damien Decremer CLA
Modified: 2013-04-29 18:38 EDT (History)
2 users (show)

See Also:


Attachments
proposed patch (4.14 KB, text/plain)
2013-03-05 12:09 EST, Louis Orenstein CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Damien Decremer CLA 2012-09-25 06:40:11 EDT
I'm used to comment/uncomment lines as in Kwrite or Kate in KDE or even in Matlab. That is, in several "layers".

For example, fortran code can look like this:
print *,hello
!print *,hellu
print *,hello
!!print *,hella
!!!!print *,helli

If I select all the lines and uncomment them, it should look like this:
print *,hello
print *,hellu
print *,hello
!print *,hella
!!!print *,helli
From here, commenting lines should simply put a single ! in front of each line again.

Instead, because only the so-called "Photran Block Comment" function is available, which is just a toggling comment command, I end up with this:
!print *,hello
print *,hellu
!print *,hello
!print *,hella
!!!print *,helli

Using the same Photran Block comment on all lines again results in this:
print *,hello
!print *,hellu
print *,hello
print *,hella
!!print *,helli

Using it again subsequently ends up cycling between
!print *,hello
print *,hellu
!print *,hello
!print *,hella
!print *,helli

and
print *,hello
!print *,hellu
print *,hello
print *,hella
print *,helli
It ends up eating all my layers of !

I find toggling comments in eclipse extremely user-UNfriendly! 
I see a lot of comment/uncomment commands in "keys" in preferences, but only the bindings to Photran Block Comment has an effect.

Comment/Uncommenting as in Kwrite, Kate or Matlab is very useful when quickly disabling parts of code, but still keeping those parts ready to reactivate. For example in trial and error coding (which is very useful when coding in Fortran).

I use the Photran editor the most and the comment/uncomment functions work fine in C++ editor.  Would it be possible to integrate these functions in Photran editor too?


I found a workaround for now: I have to shift code left or right first before toggling comments. It is extremely annoying because shifting code is very slow. That is, it takes 4 seconds to shift 1 indentation distance.  Somehow, shifting codes seems to suck up memory.  This is not good when trying to code fast!
In addition, I have to use two series of shortcuts, which I'd rather avoid.


Thanks in advance,
Damien
Comment 1 Louis Orenstein CLA 2013-03-05 12:09:13 EST
Created attachment 227948 [details]
proposed patch

I confirm that:

(a) I wrote 100% of the code without incorporating content from elsewhere or relying on the intellectual property of others
(b) I have the right to contribute the code to Eclipse
(c) I have included the EPL license header in all source files.
Comment 2 Louis Orenstein CLA 2013-03-05 12:17:00 EST
Patch uses only the first selected line to determine whether the lines in the block selection will have a comment added or removed (similar to block comment toggle works for Java editor in eclipse)

Additionally, maintains the selection region from before the comment toggle, instead of changing the selection to be the whole 1st and last lines.
Comment 3 Jeffrey Overbey CLA 2013-04-29 18:16:30 EDT
This is a small patch, so I was able to commit it without a full IP review.  Thanks again, Lou.

Applied in master for Kepler GA.