NO

Author Topic: snippets db  (Read 5319 times)

czerny

  • Guest
snippets db
« 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

CommonTater

  • Guest
Re: snippets db
« Reply #1 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.


czerny

  • Guest
Re: snippets db
« Reply #2 on: July 10, 2011, 12:08:50 am »
exactly!

CommonTater

  • Guest
Re: snippets db
« Reply #3 on: July 10, 2011, 12:38:53 am »
exactly!

Ummmm.... meaning what? 

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


czerny

  • Guest
Re: snippets db
« Reply #4 on: July 10, 2011, 01:33:41 am »
This was the way that didn't work!

Have you tryed to do the same?

czerny

CommonTater

  • Guest
Re: snippets db
« Reply #5 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....



« Last Edit: July 10, 2011, 03:49:23 am by CommonTater »

Offline AlexN

  • Global Moderator
  • Member
  • *****
  • Posts: 392
    • Alex's Link Sammlung
Re: snippets db
« Reply #6 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).
best regards
 Alex ;)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1974
Re: snippets db
« Reply #7 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;
}
« Last Edit: July 11, 2011, 02:32:57 pm by timovjl »
May the source be with you

CommonTater

  • Guest
Re: snippets db
« Reply #8 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 ... ???


czerny

  • Guest
Re: snippets db
« Reply #9 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

CommonTater

  • Guest
Re: snippets db
« Reply #10 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...


czerny

  • Guest
Re: snippets db
« Reply #11 on: July 22, 2011, 01:22:19 am »
Thats not the point!

Can you save it than?

czerny

CommonTater

  • Guest
Re: snippets db
« Reply #12 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

czerny

  • Guest
Re: snippets db
« Reply #13 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