Fix crashes when parsing the output of a compiler which reports errors on line 0.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3834 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
cad7c8269a
commit
09f5851d79
@ -1,3 +1,10 @@
|
||||
2009-06-01 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
|
||||
* src/build.c, src/editor.c:
|
||||
Fix crashes when parsing the output of a compiler which reports
|
||||
errors on line 0.
|
||||
|
||||
|
||||
2009-06-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* src/highlighting.c:
|
||||
|
@ -824,7 +824,11 @@ static void process_build_output_line(const gchar *str, gint color)
|
||||
GeanyDocument *doc = document_find_by_filename(filename);
|
||||
|
||||
if (doc)
|
||||
editor_indicator_set_on_line(doc->editor, GEANY_INDICATOR_ERROR, line - 1);
|
||||
{
|
||||
if (line > 0) /* some compilers, like pdflatex report errors on line 0 */
|
||||
line--; /* so only adjust the line number if it is greater than 0 */
|
||||
editor_indicator_set_on_line(doc->editor, GEANY_INDICATOR_ERROR, line);
|
||||
}
|
||||
color = COLOR_RED; /* error message parsed on the line */
|
||||
}
|
||||
g_free(filename);
|
||||
|
@ -3769,20 +3769,25 @@ void editor_indicator_set_on_line(GeanyEditor *editor, gint indic, gint line)
|
||||
gchar *linebuf;
|
||||
|
||||
g_return_if_fail(editor != NULL);
|
||||
g_return_if_fail(line >= 0);
|
||||
|
||||
start = sci_get_position_from_line(editor->sci, line);
|
||||
end = sci_get_position_from_line(editor->sci, line + 1);
|
||||
|
||||
/* skip blank lines */
|
||||
if ((start + 1) == end ||
|
||||
start > end ||
|
||||
sci_get_line_length(editor->sci, line) == editor_get_eol_char_len(editor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
len = end - start;
|
||||
linebuf = sci_get_line(editor->sci, line);
|
||||
|
||||
/* don't set the indicator on whitespace */
|
||||
while (isspace(linebuf[i])) i++;
|
||||
while (isspace(linebuf[i]))
|
||||
i++;
|
||||
while (len > 1 && len > i && isspace(linebuf[len-1]))
|
||||
{
|
||||
len--;
|
||||
|
Loading…
x
Reference in New Issue
Block a user