How to TOGGLE PHP comments?

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.
  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;
Post Reply
zuggsoft
Posts: 11
Joined: Sat Nov 08, 2008 7:26 am

How to TOGGLE PHP comments?

Post by zuggsoft »

Right now, this is the main issue preventing me from using Rapid PHP on a regular basis...it is *really* starting to bug me. I have tested this in the latest 9.4.0.102 version.

The PHP/PHP Line Comment menu command only seems to ADD a comment to a line. For example, click on a line and then select PHP Line Comment. The // is added to the beginning of the line. Now select Line Comment again, and *another* // comment is added. I need a way to TOGGLE the // comment on a line.

If I select a block of text, the Line Comment adds the // to each line, and if I select the same block of text again, then Line Comment *will* remove the comments. So this *does* act as a toggle when multiple lines are selected. This is inconsistent and doesn't work on just a single line when the text isn't selected.

Also, when commenting a selection of text, the line following the selection is also commented. For example, if I have:

Code: Select all

  line 1
  line 2
  line 3
and I select line 1 and line 2 (by clicking and dragging the mouse in the line-number area), and then select Line Comment, the // is also added to "line 3", even though "line 3" is not selected. The problem is that the cursor is at the beginning of line 3, and the bug is that it comments out the line with the cursor even if it's not selected.

In general this whole function is a mess. And I use this function a lot in my coding. Please clean this up soon before I give up and go back to a different PHP IDE. Thanks.
User avatar
Karlis
Site Admin
Posts: 3605
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe
Contact:

Re: How to TOGGLE PHP comments?

Post by Karlis »

I re-tested it and it works as expected. But there is one thing you should note. The cursor must be inside of the comment, if it is inside the code, the program, of course thinks that you want to add a new comment tag. So if you want to remove comment, make sure cursor is inside the comment and not inside the code.

Example, if cursor is | and you have code:

Code: Select all

|echo $test; // prints test value
toggling the comment would result in

Code: Select all

//|echo $test; // prints test value
---

Now about the second problem, when you select lines by dragging mouse over the gutter (line numbers), the newline after the last selected line is also selected and the cursor pops to the next line. Why? Becuase this lets you cut/copy the selected lines with the trailing newline included for easy pasting also this helps to quickly remove lines without leaving a blank line. However, to avoid adding comment to the last line, make sure the last line does not have cursor in it.

Or, am I not getting something here? If so, please elaborate.
Karlis Blumentals
Blumentals Software
www.blumentals.net
Post Reply