From ada3336bd8038329043fda2b6483b4b3dc6fb5e3 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Thu, 1 Jul 2010 17:08:00 +0000 Subject: [PATCH] Limit build error editor indicators to 50, but parse all errors in the Compiler tab (fixes #3019823). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5081 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 3 +++ doc/geany.html | 47 +++++++++++++++------------------------------- doc/geany.txt | 28 +++++++++++---------------- src/build.c | 51 +++++++++++++++++++++++++------------------------- src/build.h | 2 -- 5 files changed, 55 insertions(+), 76 deletions(-) diff --git a/ChangeLog b/ChangeLog index d451b6bb0..5c78967c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,9 @@ * src/printing.c, doc/geany.txt, doc/geany.html: Always use white background color when printing (except for text with a white foreground) to save ink (should fix #2968998). + * src/build.c, src/build.h, doc/geany.txt, doc/geany.html: + Limit build error editor indicators to 50, but parse all errors in + the Compiler tab (fixes #3019823). 2010-06-30 Nick Treleaven diff --git a/doc/geany.html b/doc/geany.html index 2f34e6914..3317be4f8 100644 --- a/doc/geany.html +++ b/doc/geany.html @@ -474,12 +474,11 @@ of this program, and also in the chapter project.h
  • editor.h
  • keyfile.c
  • -
  • build.h
  • -
  • build.c
  • +
  • build.c
  • -
  • GNU General Public License
  • -
  • License for Scintilla and SciTE
  • +
  • GNU General Public License
  • +
  • License for Scintilla and SciTE
  • @@ -5726,7 +5725,7 @@ Geany provide.
    -

    build.h

    +

    build.c

    @@ -5741,35 +5740,19 @@ Geany provide. - - +just after-effects. +All errors in the Compiler window are parsed +and unaffected by this value. + - -
    GEANY_BUILD_ERR_HIGHLIGHT_MAXAmount of build error messages which should -be highlighted in the Compiler message -window. This affects the special coloring +Amount of build error indicators to +be shown in the editor window. +This affects the special coloring when Geany detects a compiler output line as -an error message and then highlight the +an error message and then highlights the corresponding line in the source code. Usually only the first few messages are interesting because following errors are -just aftereffects.10050
    -
    -
    -

    build.c

    - ----- - - - - - - -
    -

    GNU General Public License

    +

    GNU General Public License

                 GNU GENERAL PUBLIC LICENSE
                    Version 2, June 1991
    @@ -6132,7 +6115,7 @@ Public License instead of this License.
     
    -

    License for Scintilla and SciTE

    +

    License for Scintilla and SciTE

    Copyright 1998-2003 by Neil Hodgson <neilh(at)scintilla(dot)org>

    All Rights Reserved

    Permission to use, copy, modify, and distribute this software and @@ -6152,7 +6135,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.

    diff --git a/doc/geany.txt b/doc/geany.txt index 9f5ddebcd..aff048351 100644 --- a/doc/geany.txt +++ b/doc/geany.txt @@ -4754,29 +4754,23 @@ GEANY_MAX_AUTOCOMPLETE_WORDS How many autocompletion suggestions should 30 Geany provide. ============================== ============================================ ================== -build.h -------- - -============================== ============================================ ================== -Option Description Default -============================== ============================================ ================== -GEANY_BUILD_ERR_HIGHLIGHT_MAX Amount of build error messages which should 100 - be highlighted in the Compiler message - window. This affects the special coloring - when Geany detects a compiler output line as - an error message and then highlight the - corresponding line in the source code. - Usually only the first few messages are - interesting because following errors are - just aftereffects. -============================== ============================================ ================== - build.c ------- ============================== ============================================ ================== Option Description Default ============================== ============================================ ================== +GEANY_BUILD_ERR_HIGHLIGHT_MAX Amount of build error indicators to 50 + be shown in the editor window. + This affects the special coloring + when Geany detects a compiler output line as + an error message and then highlights the + corresponding line in the source code. + Usually only the first few messages are + interesting because following errors are + just after-effects. + All errors in the Compiler window are parsed + and unaffected by this value. PRINTBUILDCMDS Every time a build menu item priority FALSE calculation is run, print the state of the menu item table in the form of the table diff --git a/src/build.c b/src/build.c index 6e573eda2..5ec017b4d 100644 --- a/src/build.c +++ b/src/build.c @@ -60,6 +60,9 @@ #include "toolbar.h" #include "geanymenubuttonaction.h" +/* Number of editor indicators to draw - limited as this can affect performance */ +#define GEANY_BUILD_ERR_HIGHLIGHT_MAX 50 + GeanyBuildInfo build_info = {GEANY_GBG_FT, 0, 0, NULL, GEANY_FILETYPES_NONE, NULL, 0}; @@ -968,6 +971,8 @@ static GPid build_run_cmd(GeanyDocument *doc, gint cmdindex) static void process_build_output_line(const gchar *str, gint color) { gchar *msg, *tmp; + gchar *filename; + gint line; msg = g_strdup(str); @@ -976,34 +981,30 @@ static void process_build_output_line(const gchar *str, gint color) if (! NZV(msg)) return; - if (build_info.message_count < GEANY_BUILD_ERR_HIGHLIGHT_MAX) + if (build_parse_make_dir(msg, &tmp)) { - gchar *filename; - gint line; - - build_info.message_count++; - - if (build_parse_make_dir(msg, &tmp)) - { - setptr(current_dir_entered, tmp); - } - msgwin_parse_compiler_error_line(msg, current_dir_entered, &filename, &line); - if (line != -1 && filename != NULL) - { - GeanyDocument *doc = document_find_by_filename(filename); - - if (doc && editor_prefs.use_indicators) - { - 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); + setptr(current_dir_entered, tmp); } - msgwin_compiler_add_string(color, msg); + msgwin_parse_compiler_error_line(msg, current_dir_entered, &filename, &line); + if (line != -1 && filename != NULL) + { + GeanyDocument *doc = document_find_by_filename(filename); + + /* limit number of indicators */ + if (doc && editor_prefs.use_indicators && + build_info.message_count < GEANY_BUILD_ERR_HIGHLIGHT_MAX) + { + 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); + } + build_info.message_count++; + color = COLOR_RED; /* error message parsed on the line */ + } + g_free(filename); + + msgwin_compiler_add_string(color, msg); g_free(msg); } diff --git a/src/build.h b/src/build.h index f6d3c4f41..fd459e45c 100644 --- a/src/build.h +++ b/src/build.h @@ -26,8 +26,6 @@ #ifndef GEANY_BUILD_H #define GEANY_BUILD_H 1 -#define GEANY_BUILD_ERR_HIGHLIGHT_MAX 100 - /* Order is important (see GBO_TO_GBG, GBO_TO_CMD below) */ /** Geany Known Build Commands. * These commands are named after their default use.
    OptionDescriptionDefault
    PRINTBUILDCMDS Every time a build menu item priority calculation is run, print the state of the @@ -5787,7 +5770,7 @@ overriding the compile setting.