diff --git a/src/highlighting.c b/src/highlighting.c index 65d15164b4..f0669e5ba3 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -1159,6 +1159,30 @@ void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft) } +/** Retrieves a @a named_style. + * If a style with the name @a named_style does not exist, NULL will be returned. + * @param named_style Key/name of the style as specified in the colorscheme file + * @return A pointer to the style struct. + */ +GEANY_API_SYMBOL +const GeanyLexerStyle *highlighting_get_named_style(const gchar *named_style) +{ + GeanyLexerStyle *cs; + gchar *comma, *name = NULL; + + g_return_val_if_fail(named_style, NULL); + name = utils_strdupa(named_style); /* named_style must not be written to, may be a static string */ + + comma = strstr(name, ","); + if (comma) + { + *comma = '\0'; /* terminate name to make lookup work */ + } + cs = g_hash_table_lookup(named_style_hash, name); + return cs; +} + + /** Retrieves a style @a style_id for the filetype @a ft_id. * If the style was not already initialised * (e.g. by by opening a file of this type), it will be initialised. The returned pointer is diff --git a/src/highlighting.h b/src/highlighting.h index 73079472c1..8c0c477baa 100644 --- a/src/highlighting.h +++ b/src/highlighting.h @@ -45,6 +45,8 @@ typedef struct GeanyLexerStyle GeanyLexerStyle; +const GeanyLexerStyle *highlighting_get_named_style(const gchar *named_style); + const GeanyLexerStyle *highlighting_get_style(gint ft_id, gint style_id); void highlighting_set_styles(ScintillaObject *sci, GeanyFiletype *ft); diff --git a/src/plugindata.h b/src/plugindata.h index 8fb0e35140..ad5ab77bbb 100644 --- a/src/plugindata.h +++ b/src/plugindata.h @@ -58,7 +58,7 @@ G_BEGIN_DECLS * @warning You should not test for values below 200 as previously * @c GEANY_API_VERSION was defined as an enum value, not a macro. */ -#define GEANY_API_VERSION 239 +#define GEANY_API_VERSION 240 /* hack to have a different ABI when built with GTK3 because loading GTK2-linked plugins * with GTK3-linked Geany leads to crash */