From 35bc076efac10d219ada2152c26379b02c9e2d34 Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Sun, 19 Jul 2026 11:17:36 +0200 Subject: [PATCH] remove error option --- uppsrc/ide/ClangTidy.cpp | 6 +++++- uppsrc/ide/Errors.cpp | 45 ++++++++++++++++++++++++++++++---------- uppsrc/ide/ide.h | 2 ++ 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/uppsrc/ide/ClangTidy.cpp b/uppsrc/ide/ClangTidy.cpp index a163989a7..3ac7eac56 100644 --- a/uppsrc/ide/ClangTidy.cpp +++ b/uppsrc/ide/ClangTidy.cpp @@ -242,7 +242,11 @@ void Ide::ClangTidy() Upp::SaveFile(cc_path, ccj.ToString()); cmdline << " -checks=" << Join(ClangTidyDlg::active_checks.GetKeys(), ",") - << " -p " << cc_path; + << " -p " << cc_path +#ifdef PLATFORM_WIN32 + << " -extra-arg=--target=x86_64-w64-mingw32" +#endif + ; String rf_path = outdir + "/clang_tidy_parameters_file"; diff --git a/uppsrc/ide/Errors.cpp b/uppsrc/ide/Errors.cpp index 5704a466b..e60d013d8 100644 --- a/uppsrc/ide/Errors.cpp +++ b/uppsrc/ide/Errors.cpp @@ -616,16 +616,46 @@ void Ide::CopyError(bool all) WriteClipboardText(s); } +void Ide::RemoveError() +{ + if(!error.IsCursor()) + return; + RemoveErrorNotes(); + String err = ~error.Get(2); + int c = error.GetCursor(); + for(int i = error.GetCount() - 1; i >= 0; i--) + if(~error.Get(i, 2) == err) + error.Remove(i); + error.SetCursor(min(error.GetCount() - 1, c)); + SelError(); + SyncErrorsMessage(); +} + void Ide::ErrorMenu(Bar& bar) { - bar.Add(error.IsCursor(), "Copy", THISBACK1(CopyError, false)); - bar.Add("Copy all", THISBACK1(CopyError, true)); + bar.Add(error.IsCursor(), "Copy", [this] { CopyError(false); }); + bar.Add("Copy all", [this] { CopyError(false); }); bar.Separator(); - bar.Add(error.IsCursor(), "Search the web..", IdeImg::Google(), [=] { + bar.Add(error.IsCursor() && error.Get("NOTES") != "0", + "Remove all instances of this error", [this] { RemoveError(); }); + bar.Separator(); + bar.Add(error.IsCursor(), "Search the web..", IdeImg::Google(), [this] { LaunchWebBrowser("https://www.google.com/search?q=" + GetErrorsText(false, false)); }); } +void Ide::RemoveErrorNotes() +{ + int sc = error.GetScroll(); + removing_notes = true; + for(int i = error.GetCount() - 1; i >= 0; i--) + if(error.Get(i, "NOTES") == "0") + error.Remove(i); + removing_notes = false; + error.ScrollTo(sc); + error.ScrollIntoCursor(); +} + void Ide::SelError() { if(removing_notes) @@ -633,14 +663,7 @@ void Ide::SelError() if(error.IsCursor()) { Value v = error.Get("NOTES"); if(v != "0") { // "0" - expanded note - int sc = error.GetScroll(); - removing_notes = true; - for(int i = error.GetCount() - 1; i >= 0; i--) - if(error.Get(i, "NOTES") == "0") - error.Remove(i); - removing_notes = false; - error.ScrollTo(sc); - error.ScrollIntoCursor(); + RemoveErrorNotes(); ValueArray n = v; int ii = error.GetCursor(); for(int i = 0; i < n.GetCount(); i++) { diff --git a/uppsrc/ide/ide.h b/uppsrc/ide/ide.h index 5bda6634c..4fb2b729f 100644 --- a/uppsrc/ide/ide.h +++ b/uppsrc/ide/ide.h @@ -1134,6 +1134,7 @@ public: void SyncErrorsMessage(); String GetErrorsText(bool all, bool src); void CopyError(bool all); + void RemoveError(); void ErrorMenu(Bar& bar); void ShowError(); void NewFFound(); @@ -1144,6 +1145,7 @@ public: void ShowFound(ArrayCtrl& list); void CopyFound(ArrayCtrl& list, bool all); void FFoundMenu(ArrayCtrl& list, Bar& bar); + void RemoveErrorNotes(); void SelError(); void ClearErrorsPane(); WString FormatErrorLine(const String& text, int& linecy);