From e1bbcb4ecea67b519279ec3ee059845a4f1111c8 Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 17 Jun 2014 10:41:00 +0000 Subject: [PATCH] ide: error handling improvements... git-svn-id: svn://ultimatepp.org/upp/trunk@7453 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CodeEditor/CInit.cpp | 1 + uppsrc/ide/Console.cpp | 13 ++++++++++--- uppsrc/ide/Errors.cpp | 5 ++++- uppsrc/ide/ide.h | 3 ++- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/uppsrc/CodeEditor/CInit.cpp b/uppsrc/CodeEditor/CInit.cpp index 0acf24292..766d71a1b 100644 --- a/uppsrc/CodeEditor/CInit.cpp +++ b/uppsrc/CodeEditor/CInit.cpp @@ -263,6 +263,7 @@ void CSyntax::InitKeywords() "BIT", "BIT_ARRAY", "BIT_", "BIT_ARRAY_", "BOOL", "BOOL_ARRAY", "BOOL_", "BOOL_ARRAY_", "INT", "INT_ARRAY", "INT_", "INT_ARRAY_", + "INT64", "INT64_ARRAY", "INT64_", "INT64_ARRAY_", "DOUBLE", "DOUBLE_ARRAY", "DOUBLE_", "DOUBLE_ARRAY_", "DATE", "DATE_ARRAY", "DATE_", "DATE_ARRAY_", "DATETIME", "DATETIME_ARRAY", "DATETIME_", "DATETIME_ARRAY_", diff --git a/uppsrc/ide/Console.cpp b/uppsrc/ide/Console.cpp index 60f421510..17c55213f 100644 --- a/uppsrc/ide/Console.cpp +++ b/uppsrc/ide/Console.cpp @@ -56,7 +56,16 @@ void Console::Append(const String& s) { SetEditable(); MoveTextEnd(); WString t = Filter(FromSystemCharset(s), sAppf).ToWString(); - int l0 = GetLineCount() - 1; + if(IsRunning()) + for(const wchar *q = t; *q; q++) { + if(*q == '\n') { + WhenLine(line.ToString()); + line.Clear(); + } + else + if((byte)*q >= ' ') + line.Cat(*q); + } int mg = sb.GetReducedViewSize().cx / GetFont().Info().GetAveWidth(); if(wrap_text && mg > 4) { int x = GetColumnLine(GetCursor()).x; @@ -82,8 +91,6 @@ void Console::Append(const String& s) { SetEditPos(p); SetSelection(l, h); } - while(l0 >= 0 && l0 < GetLineCount() - 1) - WhenLine(GetUtf8Line(l0++)); } bool Console::Key(dword key, int count) { diff --git a/uppsrc/ide/Errors.cpp b/uppsrc/ide/Errors.cpp index fcbc64eba..75c062674 100644 --- a/uppsrc/ide/Errors.cpp +++ b/uppsrc/ide/Errors.cpp @@ -5,7 +5,6 @@ bool Ide::FindLineError(const String& ln, FindLineErrorCache& cache, ErrorInfo& VectorMap bm = GetMethodVars(method); bool is_java = (bm.Get("BUILDER", Null) == "JDK"); const char *s = ln; - f.kind = ln.Find("error", 0) > 0 ? 1 : (ln.Find("warning", 0) > 0 ? 2 : ln.Find("note") > 0 ? 3 : 4); while(*s == ' ' || *s == '\t') s++; for(; s < ln.End(); s++) { @@ -72,6 +71,10 @@ bool Ide::FindLineError(const String& ln, FindLineErrorCache& cache, ErrorInfo& if(p.Char(':') && p.IsInt()) f.linepos = p.ReadInt(); const char *ms = p.GetPtr(); + int pos = ms - ~ln; + f.kind = ln.Find("error", pos) > 0 ? 1 : + ln.Find("warning", pos) > 0 ? 2 : + ln.Find("note", pos) > 0 ? 3 : 4; const char *hs = ms; while(!IsLetter(*hs) && *hs) hs++; diff --git a/uppsrc/ide/ide.h b/uppsrc/ide/ide.h index c9c9aaf85..7d9963aed 100644 --- a/uppsrc/ide/ide.h +++ b/uppsrc/ide/ide.h @@ -85,6 +85,7 @@ protected: int console_lock; bool wrap_text; FrameBottom input; + WString line; void CheckEndGroup(); void FlushConsole(); @@ -112,7 +113,7 @@ public: int Flush(); void Kill(int slot); void Kill(); - void ClearError() { error_keys.Clear(); } + void ClearError() { error_keys.Clear(); line.Clear(); } Vector PickErrors() { Vector e = pick(error_keys); error_keys.Clear(); return pick(e); } void Wait(int slot); bool Wait();