[Geany-devel] Deep editor customization....
enrico.troeger at xxxxx
Sat May 9 09:28:37 UTC 2009
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
custom_font = g_strdup(list);
And don't forget to g_free() these strings afterwards in
- 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
- 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).
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: not available
More information about the Devel