[Geany] toggle comment skips some lines.

Enrico Tröger enrico.troeger at xxxxx
Sun Sep 26 18:05:23 UTC 2010


On Fri, 24 Sep 2010 13:10:24 +0100, Nick wrote:

>On Fri, 24 Sep 2010 10:59:26 +0200
>Joerg Desch <jd.vvd at web.de> wrote:
>
>> > I still can't reproduce this with a clean config. Can you give a
>> > code example of what doesn't work?
>> 
>> Today, I've installed a fresh Geany (with GTK) onto a Vista notebook.
>> After the installation, I've started Geany, created a new C-Source
>> and typed a "foo" function. Than I marked the content of the scope
>> of the function end pressed Ctrl-E. This is the result:
>> 
>> 
>> void foo (void)
>> {
>> 	//~ int i;
>> 	
>> 	for (i = 0; i <3; i++)
>> 	//~ {
>> 		//~ printf("%d\n",i);
>> 	//~ }
>> }
>> 
>> As you can see, the "for (" isn't commented out. If I remove the
>> empty line, all works as expected.
>
>OK, I can reproduce this when using Windows line endings. I didn't
>think of that before ;-)
>
>I can't find an easy fix though, the code is quite hard to follow.

I must agree :(.

Anyway, the fix seems to be quite easy: we read the lines to be
commented/uncommented and remove the last character ('\n' usually) but
we didn't care about CRLF. So the '\r' kept in the buffer holding the
line and that confused the other code.
I changed the code so it removes as many characters as the end of line
characters of the document take (i.e. 1 or 2). This seems to work, I
hope this won't break anything else.

Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20100926/487e49e6/attachment.pgp>


More information about the Users mailing list