Pelles C forum

Pelles C => General discussions => Topic started by: czerny on July 06, 2011, 11:06:16 pm

Title: snippets db
Post by: czerny on July 06, 2011, 11:06:16 pm
Hi,

I tryed to store this little function in the snippets db, but the I get an error message saying that this is not possible. What I am doing wrong?

int chomp(char *s)
{
   char *p = strchr(s, '\n');
   if ( p != NULL ) {
       *p = '\0';
       return 1;
     }
     return 0;
}

czerny
Title: Re: snippets db
Post by: CommonTater on July 08, 2011, 03:41:51 am
Ok... how did you try to do it?

Tools -> Customize -> snippets -> select type -> new snippet -> type or paste into dialog.

Title: Re: snippets db
Post by: czerny on July 10, 2011, 12:08:50 am
exactly!
Title: Re: snippets db
Post by: CommonTater on July 10, 2011, 12:38:53 am
exactly!

Ummmm.... meaning what? 

Did my suggestion work... or is that the one that failed?

Title: Re: snippets db
Post by: czerny on July 10, 2011, 01:33:41 am
This was the way that didn't work!

Have you tryed to do the same?

czerny
Title: Re: snippets db
Post by: CommonTater on July 10, 2011, 03:43:04 am
This was the way that didn't work!

Have you tryed to do the same?

czerny

Yep, it worked for me  on ver 6.50 rc4 x64 .... 
But I typed my test in by hand...

EDIT:
Hrrrmmmm... copy and paste from outside the IDE doesn't seem to be working
but copy and paste from an IDE source window to the snippet does.

Kinda odd....



Title: Re: snippets db
Post by: AlexN on July 11, 2011, 11:55:59 am
I (6.50 rc4 x86) tried it also (with different modifications) and I think only Pelle knows why you can't store it.

PS: If you remove the lines with "*p =" you can store it (but I think this will not help you).
Title: Re: snippets db
Post by: TimoVJL on July 11, 2011, 01:47:54 pm
Maybe problem with ' Single quote.
Use two single quotes for one single quote.
Code: [Select]
int chomp(char *s)
{
   char *p = strchr(s, ''\n'');
   if ( p != NULL ) {
       *p = ''\0'';
       return 1;
     }
     return 0;
}
Title: Re: snippets db
Post by: CommonTater on July 11, 2011, 01:59:21 pm
I don't think the snippets window does syntax checking...

What I was wondering is if it was a clipboard format problem...
Text pushed to the clipboard as ASCII where the IDE is internally unicode ... ???

Title: Re: snippets db
Post by: czerny on July 20, 2011, 10:01:43 pm
Hallo,

it looks as if the SQLite db does refuse the snipped because the single quotes are not escaped.

czerny
Title: Re: snippets db
Post by: CommonTater on July 21, 2011, 02:11:06 am
Hmmm... Ok, I took your sample code and copied it... I could paste it into the source editor but not the snippets window... if I copied it from the source editor, it pasted into the snippets window just fine...

Title: Re: snippets db
Post by: czerny on July 22, 2011, 01:22:19 am
Thats not the point!

Can you save it than?

czerny
Title: Re: snippets db
Post by: CommonTater on July 22, 2011, 04:23:15 am
When I copy from the Source editor, yes it saves.
When I copy from the first message, no it does not save.

I believe you've found a bug and you should report it as such in the appropriate forum
Title: Re: snippets db
Post by: czerny on July 22, 2011, 07:29:41 pm
This is definitivly not the case with my version (6.50.8 R4 32 bit).
I can't save it neither from notepad nor from the ide copyed.
The only way I can save it is to double the single quotes.

czerny