Since Geany 2.0 has recently been released I decided to switch back to it from Kate. I used to like Geany but it had some problems I couldn’t quite remember.

So I quickly remembered the problem. I can’t figure out how to configure it to properly comment and comment blocks of code. Say you have the following in a file of type shell script:

	# a comment
	echo $variable

I want to be able to select the above lines and use a keybinding to comment them out, so the result would be:

	## a comment
	#echo $variable

Edit > Format > Comment Lines works as anticipated.

But if I decide I want the lines back, how do that with the same keybinding? Using Comment Lines again adds a second level of comments, which is what I would expect (but not what I want):

	### a comment
	##echo $variable

Edit > Format > Toggle Line Commentation works and the file returns to the original state. But if you reselect the original lines and run it again, you get

	 a comment
	#echo $variable

Which would obviously lead to unpredictable results.

There doesn’t seem to be a way for Geany to look at the block of text and decide whether it should be commented or uncommented and act accordingly.

Kate editor has this functionality in Selection > Toggle Comment as do other editors I’ve encountered. If there is a mix of commented and uncommented text, it will never remove comments. It only removes comments when the entire block has commenting, and then it removes only 1 level of comments. Perfect. Of course if you really want to force the matter, there are the more aggressive Comment and Uncomment.

Using the Geany Toggle Line Commentation leads to strange results, especially if you are starting with multiple levels of comments. Is there a way to duplicate the standard comment toggle in Geany? I tried to train myself to use Comment Line(s) and Uncomment Lines(s) instead of a single command but I just made a lot of mistakes where I didn’t realize there were multiple levels of comments or whatever and things became uncommented that shouldn’t have and it created a giant mess.

I’m not a professional IT person, just someone who enjoys text files in their spare time. I do a lot of commenting and uncommenting trying to find out how things work. I thought it was a pretty normal thing to do. There must be a way to do it right?

I recall digging around a bunch in the Geany repo/docs and it ended up that some problem I was having was a limitation of the Scintilla lexer and there wasn’t much Geany could do about it. But I am not sure if it was this issue or something else.

  • russjr08@outpost.zeuslink.net
    link
    fedilink
    English
    arrow-up
    2
    ·
    11 months ago

    I can’t speak for all developers, but personally I’d rather have a bug report that isn’t actually a bug, but rather a user error over nothing at all. Because that means that my expectation of how others might use a feature could be incorrect which is a bug to me - just not a programmatic bug.

    Some developers may of course not be as of appreciative of it, but I’d say so long as you have a cursory look at their issue tracker and no one else has reported it, then I’d say its worth it.