[Geany-devel] Deep editor customization....
jimmy.paillet at xxxxx
Sat May 9 09:46:11 UTC 2009
2009/5/9 Enrico Tröger <enrico.troeger at uvena.de>
> On Fri, 8 May 2009 20:59:15 +0200, Jimmy wrote:
> >ok, just for fun, here's a patch to a basic functional version...(and
> >the modified files in case patch is not working acording to plans...)
> >it's tiny modifications to src/highlighting.c and src/highlighting.h :D
> A few notes:
> - Don't use strcpy() with fixed sized strings like gchar custom_font
> this can easily lead to memory corruptions and so crashes. It's easier
> and safer (while being a little less performant) to use dynamically
> allocated strings on the heap, e.g. with g_strdup(), so
> gchar custom_font;
> strcpy(style->custom_font, list);
> gchar *custom_font;
> custom_font = g_strdup(list);
> And don't forget to g_free() these strings afterwards in
yep i knew it was dodgy...ok i'll modify my stuff to get along these lines
> - if (condition)
> looks nicer than
> if (condition) code();
> but this is just cosmetic.
> - I think we should add the "!" to request Pango fonts in the code,
> I don't think users want to use GDK fonts and mixing both is probably
> not possible at all and even if, it's not desirable. Furthermore,
> having the "!" in the filetype definition files seems error-prone
> because it can be easily forgotten.
> This is why I suggest to specify only fontnames in the filetype
> definition files and add the "!" directly when reading the names in
ok...I was just using the scintilla model here...
forgetting the ! does not lead to an error, it just
don't anti-alias your font...
I'm not sure who, but someone might still want to have this control...
> - strlen(style_ptr->custom_font) > 0
> can be easier written as
> which is a little more performant and easier to read (the NZV() macro is
> defined in src/utils.h).
I didn't come across this yet...it's useful thanks
> Get my GPG key from http://www.uvena.de/pub.asc
> Geany-devel mailing list
> Geany-devel at uvena.de
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Devel