[geany/geany-plugins] 236363: addons/tasks: Do not extract tokens from non-comments
Quentin Glidic
git-noreply at xxxxx
Fri Jun 17 12:50:07 UTC 2016
Branch: refs/heads/master
Author: Quentin Glidic <sardemff7+git at sardemff7.net>
Committer: Quentin Glidic <sardemff7+git at sardemff7.net>
Date: Fri, 17 Jun 2016 12:50:07 UTC
Commit: 236363f0e7dfab7db8690cc051a53417da6ece06
https://github.com/geany/geany-plugins/commit/236363f0e7dfab7db8690cc051a53417da6ece06
Log Message:
-----------
addons/tasks: Do not extract tokens from non-comments
Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
Modified Paths:
--------------
addons/src/ao_tasks.c
Modified: addons/src/ao_tasks.c
11 lines changed, 8 insertions(+), 3 deletions(-)
===================================================================
@@ -558,27 +558,31 @@ static void create_task(AoTasks *t, GeanyDocument *doc, gint line, const gchar *
static void update_tasks_for_doc(AoTasks *t, GeanyDocument *doc)
{
- gint lines, line;
+ gint lexer, lines, line, last_pos = 0, style;
gchar *line_buf, *display_name, *task_start;
gchar **token;
AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t);
if (doc->is_valid)
{
display_name = document_get_basename_for_display(doc, -1);
+ lexer = sci_get_lexer(doc->editor->sci);
lines = sci_get_line_count(doc->editor->sci);
for (line = 0; line < lines; line++)
{
- line_buf = g_strstrip(sci_get_line(doc->editor->sci, line));
+ line_buf = sci_get_line(doc->editor->sci, line);
for (token = priv->tokens; *token != NULL; ++token)
{
if (EMPTY(*token))
continue;
if ((task_start = strstr(line_buf, *token)) == NULL)
continue;
+ style = sci_get_style_at(doc->editor->sci, last_pos + (task_start - line_buf));
+ if (!highlighting_is_comment_style(lexer, style))
+ continue;
/* skip the token and additional whitespace */
- task_start += strlen(*token);
+ task_start = strstr(g_strstrip(line_buf), *token) + strlen(*token);
while (*task_start == ' ' || *task_start == ':')
task_start++;
/* reset task_start in case there is no text following */
@@ -590,6 +594,7 @@ static void update_tasks_for_doc(AoTasks *t, GeanyDocument *doc)
break;
}
g_free(line_buf);
+ last_pos = sci_get_line_end_position(doc->editor->sci, line) + 1;
}
g_free(display_name);
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list