Comment region


#1

I’ve been using Komodo Edit 11 for some time. When editing HTML files I frequently use “Comment Region” and “Un-Comment Region”. In Komodo Edit 11 the behavior is that if I have several lines marked and select “Comment Region” I get a single line comment for each line:

<ul>
<li>Item 1</li>
<!--<li>Item 2</li>-->
<!--<li>Item 3</li>-->
<!--<li>Item 4</li>-->
</ul>

As I moved to Komodo IDE 12.0 I have noticed that the same functionality now has a different behavior. Now it inserts a “true” block comment:

<ul>
<li>Item 1</li>
<!--<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>-->
</ul>

I assume this is intended behavior but I actually prefer the former style since I frequently comment out several lines in lists like the one above, and then I uncomment these lines one by one. I also use grep to see if lines are commented out or not, and this doesn’t work as several lines in the true block comment won’t show any signs of being commented out when presented without context.

Would it be feasible to have an option to use the old style comments?

Thank you!


#2

@JesperIRL

I just installed and tried this in Edit 12 and 11. In html files, block comments are not line by line.

block-comment

I had a look through the code and prefs and I don’t see anything about changing that functionality (always gotta check, the code base and feature/prefs set is huge). I’m not sure why you’re install was different but maybe the next paragraph is related?

I DID notice that if you do Block Selection then Komodo will default to commenting each line separately. You can block comment using Alt + Click & Drag in the editor.

  • Carey

#3

This is interesting… When I now open Edit 11, use shift and arrow keys to mark a few lines and hit cmd+/ I get a block comment, the same as in IDE 12. This is the first time I have seen block comments in Edit 11, and I have used that for quite some time.

I get that this is the intended behavior and I guess it’s good that my version behaves as “normal” after all this time, but I wonder what I could have done to get the line-by-line comments before…

Anyway, block selection gives line-by-line comments as you say, so that will solve my problem in IDE 12 even though it’s a lot more work to mark a block since I have to not only go down, but also right - to the end of the block.

As I tried the block comments I noticed two behaviors that I find weird and quite limiting:

  1. I have a block like this:
    <p>
    Some text that has a few lines that are approx 80-100 characters long.
    </p>
    and I want to block-mark this using the arrow keys (I don’t use the mouse). I start at the upper left corner (before <p>), shift+ctrl+down twice, and shift+ctrl+left once to get to the end of the first long text line. From here it’s fairly quick to go down a few lines to get to the bottom right corner of the block I want to mark, but, when I get to a line that is shorter the cursor jumps back left to the end of that line. This is especially annoying as the last line is always really short (</p>). It would be a lot easier to mark blocks if the cursor simply moved straight down and ignored the length of lines. Currently I have to either comment out the last line in a separate action, or use the right arrow key to walk all the way out to column 100 manually, which is really slow.

  2. After having made a block comment the “block mode” seems to linger. Whenever I use the up or down arrow keys the cursor seems to stretch over the touched lines, and if I start typing the text appears on all lines covered by the cursor. I can’t figure out how to exit this mode and get normal arrow key behavior back.


#4

@JesperIRL,

There is no preference to adjust the behavior in item 1, if that is what you’re asking for.

For 2, pressing Esc should cancel the selection.

  • Carey.

#5

#1 - I guess I see it more as a bug actually. If I have moved x steps to the right when making a block selection and then goes a few lines down (or up) I don’t think it’s the right behavior to jump back to column x-n. I know what comes next - I should go to the bugtracker and file an issue there - unless you think I’m just being silly with such an expectation?

#2 - esc cancels the current selection but the next time I press up or down a new selection starts.


#6

Morning @JesperIRL,

  1. You can file an enhancement request in the bug tracker if you have time:
    https://github.com/komodo/komodoedit/issues/new

  2. I’m not actually able to reproduce this. Let’s break this out into a new thread to see if we can dig something up.


#7
  1. I filed https://github.com/Komodo/KomodoEdit/issues/3841
  2. I don’t know if this forum has a way to send private messages, but If there is a way we can connect IRL I could set up a Zoom session and show this issue. Then we could also look att the problems with remote files that are discussed here: https://github.com/Komodo/KomodoEdit/issues/3837 (which I haven’t had time to gather the logs for yet).

#8
  1. Thanks for filing that.

  2. I appreciate that you’d like to get everything fixed asap but one on one screen share debugging is not a level of service we offer in the forums. I need you to do your best to try and see what triggers the issue.

For #3837, try the timeout pref I suggested.

  • Carey

#9

Since you don’t recognise the behavior I’ll refer to it as a bug.

This is what I have found:

  • It’s clearly related to commenting out a section marked by a block. These steps reproduce every time for me:
    – Open a file (I’ve tried HTML, PHP, sh, C++, and Java)
    – Use shift+ctrl+arrow keys to mark a block
    – Use command+/ to comment out the block
    – The bug now reproduces - use arrow keys up/down to extend the cursor over several lines

  • It’s a per file/tab issue. Once I trigger it in one file it stays there until I close the file/restart Komodo IDE. If switch to a different tab the bug doesn’t follow. But if I comment out a block selection the bug reproduces in that tab as well, and stays there as well until closing.

I guess I should go file this one in the bug tracker as well :slight_smile:


#10

Filed https://github.com/Komodo/KomodoEdit/issues/3842

I also have some more info on the selection of a block that I think makes it a bug rather than a enhancement request. I’ll update #3841 with that info.


#11

@JesperIRL,

Repro-step worked like a charm in #3842.

Responded to #3841 in the ticket.

  • Carey