Hello, when setting geany to remove whitespace at the end of each line and toggling comments with the default comment marker "~ ", sometimes these spaces get removed if there is nothing on that line. After which you must manually delete the comments. Changing the default comment marker to " `" avoids this problem, but still allows you to read your code fine. A trivial patch is attached that changes this default.
changes the default comment marker from "~ " to " `"
Not sure we want this change as the space helps in reading commented out code. A better fix would be to make geany recognise toggled empty lines with stripped trailing space.
> the space helps in reading commented out code
Here I meant a space immediately before the commented out code.
I know, I thought about that when I found the bug. That's why I chose ' `' to replace it, because '`' is small so you can still read your code. I guess we could have geany just not comment lines consisting only of whitespace, that'd work
so apparently not commenting empty/whitespace-only lines is already possible in `editor_do_comment` (line 3165 of editor.c). The option is called `allow_empty_lines`, and is set to TRUE in 2 of the 3 function calls. Setting it to TRUE in the third gives us the desired behavior (empty lines not commented), but also makes the selection jump to the next time each time 'toggle comment' is invoked if the next line is whitespace. Should we remove the `allow_empty_lines` option and then make sure geany doesn't change the selection when toggling comments? This seems sensible to me, though I haven't tested multi-line comments without that option.
stops blank lines from being commented when single line comments are used
That patch (just attached) should do it. If blank lines aren't commented, there's no way for their whitespace to be stripped upon saving :)
added a pull request to the new git repo: https://github.com/geany/geany/pull/1
The bug is fixed with this change (pull req: pull request for this change here: https://github.com/geany/geany/pull/6 ; commit: https://github.com/geany/geany/commit/cbadf177f4ec4b85f76962dc73fd421481f072af )
sorry about the confusion, here: https://github.com/geany/geany/pull/6 is the pull request in question