Block|Comment

(available in EditPad Pro only)

Select Comment from the Block menu to comment out a piece of code in a source code file.

If the current file is being syntax colored by a syntax coloring scheme that contains a character string for single-line comments, Block|Comment automatically uses those characters. If there is no selection, the comment characters are inserted at the first non-whitespace character on the line that the cursor is on. If you’ve made a selection that flows along with the text, the comment characters are inserted at the first non-whitespace character on each the line. Essentially, indentation is preserved after lines are commented out. Blank lines are not commented out.

If you’ve made a rectangular selection, the comment characters are inserted on each line covered by the selection at the leftmost column in the selection, even if the line is blank. You can make a rectangular selection at the start of the lines you want to comment out of you prefer all the comment characters to be at the start of the line. If rectangular selections are not available, you can make a normal selection and use Block|Prefix instead to insert the comment characters.

If the syntax coloring scheme does not define characters for single-line comments, but does define characters for multi-line comments, then Block|Comment inserts the characters that start a multi-line comment in the same way that it inserts characters that start a single-line comment. It then additionally inserts the characters that end a multi-line comment at the end of each line or at the right-hand edge of the selection if it is rectangular.

If the current file type does not use a syntax coloring scheme, or the scheme does not define any characters to comment out something, Block|Comment asks you for the characters used to start a single-line comment. Those are then used in the same way as single-line comment characters from a single coloring scheme. EditPad remembers the comment characters you provided separately for each file while you have the file open.

If only one line was selected or if there was no selection, Block|Comment moves the text cursor to the next line. This allows you to quickly comment out multiple lines without having to select them if you assign a keyboard shortcut to Block|Comment.

To remove the comment characters inserted by Block|Comment, use Block|Uncomment or Block|Toggle Comment.

You can use Block|Comment on lines that are already commented out. Those are then doubly commented out. This allows you to comment out a large block in which some lines are commented out and then uncomment the whole block with Block|Uncomment. The lines that were originally commented out will still be commented out.

See Also

Block menu
Block|Uncomment
Block|Toggle Comment
Block|Prefix
Block|Rectangular Selections