NO

Author Topic: snippets db  (Read 6537 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: 394
    • 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: 2150
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