Re: [Github-comments] [geany/geany] highlighting: added API call to query GeanyLexerStyle by name (#2336)

2019-10-03 Thread elextr
elextr approved this pull request.





-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/2336#pullrequestreview-297214791

Re: [Github-comments] [geany/geany] highlighting: added API call to query GeanyLexerStyle by name (#2336)

2019-10-03 Thread Matthew Brush
To be honest I dislike the idea of exposing anything colour scheme related to 
plugins as the current system is rather a mess due to how it evolved, and I'd 
very much like to be able to overhaul it - something I started some time ago, 
and will eventually continue with - without regard for breaking plugins (in 
addition to user schemes).

That said, I don't want to block progress for something that will not happen 
any time soon, so whatever.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/2336#issuecomment-538163328

Re: [Github-comments] [geany/geany] highlighting: added API call to query GeanyLexerStyle by name (#2336)

2019-10-03 Thread LarsGit223
LarsGit223 commented on this pull request.



> + * @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 */
+   }

I removed it. It was a leftover copied in from ```read_named_style()```. But it 
doesn't make sense any more.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/2336#discussion_r331244133

Re: [Github-comments] [geany/geany] highlighting: added API call to query GeanyLexerStyle by name (#2336)

2019-10-03 Thread LarsGit223
@LarsGit223 pushed 1 commit.

e096b0f080ebe92c4c4d9b9b442174212fe4f096  highlighting: added API call to query 
GeanyLexerStyle by name


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/geany/geany/pull/2336/files/9ff6031fb01b9e49cd92dc3221ac21a2e34c736f..e096b0f080ebe92c4c4d9b9b442174212fe4f096


Re: [Github-comments] [geany/geany] highlighting: added API call to query GeanyLexerStyle by name (#2336)

2019-10-03 Thread elextr
elextr requested changes on this pull request.

The use-case makes sense now that its explained clearly.

> + * @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 */
+   }

Whats this doing? If you pass a name why does it need to terminate at a comma?  
Either this is functionality specific to the particular useage, in which case 
it should be in the caller, or it should be documented behaviour with an 
explanation of why.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/2336#pullrequestreview-297130510

[Github-comments] [geany/geany] highlighting: added API call to query GeanyLexerStyle by name (#2336)

2019-10-03 Thread LarsGit223
This PR adds a new API call to ```highlighting.c```:
``` C
const GeanyLexerStyle *highlighting_get_named_style(const gchar *named_style);
```

This shall enable plugins to query styles dedicated to plugin specific 
highlighting. Plugins could have their own styles with dedicated keys/names and 
instruct users to simply add them to a colorscheme. Another option would be a 
configuration setting in a plugin but then the setting is separated from the 
colorscheme which may result in bad readability.

Also see the discussion at https://github.com/geany/geany/issues/2331.
You can view, comment on, or merge this pull request online at:

  https://github.com/geany/geany/pull/2336

-- Commit Summary --

  * highlighting: added API call to query GeanyLexerStyle by name

-- File Changes --

M src/highlighting.c (24)
M src/highlighting.h (2)
M src/plugindata.h (2)

-- Patch Links --

https://github.com/geany/geany/pull/2336.patch
https://github.com/geany/geany/pull/2336.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/2336