Index: CodeEditor/CodeEditor.cpp =================================================================== --- CodeEditor/CodeEditor.cpp (revision 57) +++ CodeEditor/CodeEditor.cpp (working copy) @@ -955,6 +955,15 @@ I <<= THISBACK1(SetI, &edit); } +void CodeEditor::SetErrors(Index* errors) +{ + if (errors) + errs = Index(*errors, 0); + else + errs.Clear(); + Refresh(); +} + CodeEditor::CodeEditor() { stat_edit_time = 0; last_key_time = Null; Index: CodeEditor/CodeEditor.h =================================================================== --- CodeEditor/CodeEditor.h (revision 57) +++ CodeEditor/CodeEditor.h (working copy) @@ -243,6 +243,8 @@ int highlight; + Index errs; + struct HlSt; const wchar *HlString(HlSt& hls, const wchar *p); @@ -275,6 +277,8 @@ void ForwardWhenBreakpoint(int i); Color BlockColor(int level); + Color BlockColorErr(int line, int level); + void Bracket(int pos, HlSt& hls); bool ToggleSimpleComment(int &start_line, int &end_line, bool usestars = true); @@ -406,6 +410,8 @@ void HideBar() { bar.Hide(); } + void SetErrors(Index* errors); + void DefaultHlStyles(); void LoadHlStyles(const char *s); String StoreHlStyles(); Index: CodeEditor/Highlight.cpp =================================================================== --- CodeEditor/Highlight.cpp (revision 57) +++ CodeEditor/Highlight.cpp (working copy) @@ -188,6 +188,14 @@ return GetHlStyle(PAPER_NORMAL).color; } +Color CodeEditor::BlockColorErr(int line, int level) +{ + if (errs.Find(line + 1) >= 0) + return GetHlStyle(PAPER_ERROR).color; + else + return BlockColor(level); +} + void CodeEditor::Bracket(int pos, HlSt& hls) { if(pos == highlight_bracket_pos0 && hilite_bracket @@ -325,11 +333,11 @@ if(!sm.macro) { int i = 0; while(i < ss.bid.GetCount() - 1 && (i >= text.GetLength() || text[i] == '\t')) { - hls.SetPaper(ss.bid[i], ss.bid[i + 1] - ss.bid[i], BlockColor(i)); + hls.SetPaper(ss.bid[i], ss.bid[i + 1] - ss.bid[i], BlockColorErr(line, i)); i++; } int t = ss.bid.GetCount() ? ss.bid[i] : 0; - hls.SetPaper(t, 1 + max(0, text.GetLength() - t), BlockColor(ss.bid.GetCount() - 1)); + hls.SetPaper(t, 1 + max(0, text.GetLength() - t), BlockColorErr(line, ss.bid.GetCount() - 1)); } while(*p == ' ' || *p == '\t') { p++; @@ -399,7 +407,7 @@ hls.Put(hl_style[INK_PAR0 + max(ss.cl++, 0) % 4]); ++block_level; if(hls.pos < text.GetCount()) - hls.SetPaper(hls.pos, text.GetCount() - hls.pos + 1, BlockColor(block_level)); + hls.SetPaper(hls.pos, text.GetCount() - hls.pos + 1, BlockColorErr(line, block_level)); p++; } else @@ -412,7 +420,7 @@ else if(*p == ')' || *p == '}' || *p == ']') { if(*p == '}' && hilite_scope) - hls.SetPaper(hls.pos, text.GetLength() + 1 - hls.pos, BlockColor(--block_level)); + hls.SetPaper(hls.pos, text.GetLength() + 1 - hls.pos, BlockColorErr(line, --block_level)); Bracket(p - text + pos, hls); int& l = *p == ')' ? ss.pl : *p == '}' ? ss.cl : ss.bl; if(ss.brk.IsEmpty() || ss.brk.Pop() != *p || l <= 0) { Index: CodeEditor/hl_color.i =================================================================== --- CodeEditor/hl_color.i (revision 57) +++ CodeEditor/hl_color.i (working copy) @@ -31,6 +31,8 @@ HL_COLOR(PAPER_BLOCK3, "Block level 3", 0) HL_COLOR(PAPER_BLOCK4, "Block level 4", 0) +HL_COLOR(PAPER_ERROR, "Compile Error", 0) + HL_COLOR(INK_MACRO, "#preprocesor text", 1) HL_COLOR(PAPER_MACRO, "#define background", 0) HL_COLOR(PAPER_IFDEF, "#if/#else/#endif background", 0) Index: ide/Build.cpp =================================================================== --- ide/Build.cpp (revision 57) +++ ide/Build.cpp (working copy) @@ -425,8 +425,9 @@ targetmode - 1); Vector errors = console.PickErrors(); host->DeleteFile(errors); - if(!ok || !errors.IsEmpty()) + if(!ok || !errors.IsEmpty()) { return false; + } if(link) { ok = b->Link(linkfile, linkopt, GetTargetMode().createmap); errors = console.PickErrors(); @@ -437,6 +438,22 @@ return true; } +void Ide::SetErrorsEdit() +{ + if (highlight_errors) { + String file; + int lineno; + One host = CreateHost(false); + errors_edit.Clear(); + for (int i = 0; i < console.GetLineCount(); i++) { + if (FindLineError(console.GetUtf8Line(i), *host, file, lineno)) { + errors_edit.GetAdd(file).FindAdd(lineno); + } + } + editor.SetErrors(errors_edit.FindPtr(editfile)); + } +} + void Ide::SetHdependDirs() { HdependSetDirs(SplitDirs(GetVar("UPP") + ';' @@ -576,6 +593,7 @@ } EndBuilding(ok); ReQualifyBrowserBase(); + SetErrorsEdit(); return ok; } @@ -700,6 +718,7 @@ } onefile.Clear(); EndBuilding(ok); + SetErrorsEdit(); } void Ide::Preprocess() { Index: ide/ide.cpp =================================================================== --- ide/ide.cpp (revision 57) +++ ide/ide.cpp (working copy) @@ -314,11 +314,27 @@ } bool Ide::FindLineError(int l, Host& host) { + String file; + int lineno; + if (FindLineError(console.GetUtf8Line(l), host, file, lineno)) { + file = NormalizePath(file); + editastext.FindAdd(file); + EditFile(file); + editor.SetCursor(editor.GetPos(editor.GetLineNo(lineno - 1))); + editor.CenterCursor(); + editor.SetFocus(); + Sync(); + console.SetSelection(console.GetPos(l), console.GetPos(l + 1)); + ShowConsole(); + return true; + } + return false; +} + +bool Ide::FindLineError(String ln, Host& host, String &file, int &lineno) { Vector wspc_paths; VectorMap bm = GetMethodVars(method); bool is_java = (bm.Get("BUILDER", Null) == "JDK"); - String ln = console.GetUtf8Line(l); - String file; const char *s = ln; while(*s == ' ' || *s == '\t') s++; @@ -365,7 +381,7 @@ if(IsFullPath(file) && FileExists(file) && IsTextFile(file)) { while(*s && !IsDigit(*s)) s++; - int lineno = 0; + lineno = 0; if(IsDigit(*s)) lineno = stou(s); Vector conf = SplitFlags(mainconfigparam, true); @@ -424,15 +440,6 @@ } } if(lineno > 0) { - file = NormalizePath(file); - editastext.FindAdd(file); - EditFile(file); - editor.SetCursor(editor.GetPos(editor.GetLineNo(lineno - 1))); - editor.CenterCursor(); - editor.SetFocus(); - Sync(); - console.SetSelection(console.GetPos(l), console.GetPos(l + 1)); - ShowConsole(); return true; } } Index: ide/ide.h =================================================================== --- ide/ide.h (revision 57) +++ ide/ide.h (working copy) @@ -624,6 +624,7 @@ String stdout_file; String recent_stdout_file; + VectorMap< String, Index > errors_edit; // ------------------------------------ One debugger; @@ -652,6 +653,7 @@ bool header_guards; bool filetabs; bool auto_enclose; + bool highlight_errors; int insert_include; int bordercolumn; Color bordercolor; @@ -808,6 +810,7 @@ String OutDir(const Index& cfg, const String& package, const VectorMap& bm, bool use_target = false); One CreateBuilder(Host *host); + void SetErrorsEdit(); bool BuildPackage(const ::Workspace& wspc, int pkindex, int pknumber, int pktotal, String mainparam, String outfile, Vector& linkfile, String& linkopt, bool link = false); @@ -900,6 +903,7 @@ void Renumber(); bool FindLineError(int l, Host& host); + bool FindLineError(String fn, Host& host, String &file, int &lineno); void FindError(); void FindWildcard(); Index: ide/ide.lay =================================================================== --- ide/ide.lay (revision 57) +++ ide/ide.lay (working copy) @@ -416,6 +416,7 @@ ITEM(Switch, insert_include, SetLabel(t_("No #include in new souces\n#include first\n#include previous")).LeftPosZ(316, 156).TopPosZ(32, 56)) ITEM(Option, header_guards, SetLabel(t_("Insert guards to new headers")).LeftPosZ(316, 164).TopPosZ(12, 15)) ITEM(Option, auto_enclose, SetLabel(t_("[ { ( \" / * enclose selection")).LeftPosZ(12, 168).TopPosZ(236, 15)) + ITEM(Option, highlight_errors, SetLabel(t_("Highlight Errors")).LeftPosZ(12, 168).TopPosZ(256, 15)) END_LAYOUT LAYOUT(SetupIdeLayout, 512, 248) @@ -485,3 +486,4 @@ ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(264, 64).TopPosZ(32, 24)) ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(332, 64).TopPosZ(32, 24)) END_LAYOUT + Index: ide/idefile.cpp =================================================================== --- ide/idefile.cpp (revision 57) +++ ide/idefile.cpp (working copy) @@ -349,6 +349,7 @@ FlushFile(); editfile = path; + editor.SetErrors(errors_edit.FindPtr(editfile)); editor.SetCharset(charset); AddLru(); Index: ide/idewin.cpp =================================================================== --- ide/idewin.cpp (revision 57) +++ ide/idewin.cpp (working copy) @@ -72,6 +72,7 @@ s % toolbar_in_row; s % filetabs; s % auto_enclose; + s % highlight_errors; s % show_tabs; s % no_parenthesis_indent; s % hilite_scope; @@ -504,6 +505,7 @@ filetabs = true; auto_enclose = false; + highlight_errors = true; bordercolumn = 96; bordercolor = SColorFace(); Index: ide/Setup.cpp =================================================================== --- ide/Setup.cpp (revision 57) +++ ide/Setup.cpp (working copy) @@ -213,6 +213,7 @@ (edt.header_guards, header_guards) (edt.insert_include, insert_include) (edt.auto_enclose, auto_enclose) + (edt.highlight_errors, highlight_errors) (edt.bordercolumn, bordercolumn) (edt.bordercolor, bordercolor) (ide.show_status_bar, show_status_bar) Index: ide/UppWspc.cpp =================================================================== --- ide/UppWspc.cpp (revision 57) +++ ide/UppWspc.cpp (working copy) @@ -369,7 +369,7 @@ filelist.SetSbPos(s); filelist.SetCursor(i); } - return; + break; } } }