remove error option

This commit is contained in:
Mirek Fidler 2026-07-19 11:17:36 +02:00
parent 142d359a87
commit 35bc076efa
3 changed files with 41 additions and 12 deletions

View file

@ -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";

View file

@ -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++) {

View file

@ -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);