From 273639ed0f45b7effb2b34b52a0b4deff1c4e616 Mon Sep 17 00:00:00 2001 From: Eran Ifrah Date: Fri, 27 Dec 2024 00:05:39 +0200 Subject: [PATCH] Fixed: honour the "Skip warnings" after build ends this should close issue: https://github.com/eranif/codelite/issues/3552 (along with the previous commit) Signed-off-by: Eran Ifrah --- LiteEditor/BuildTabView.cpp | 24 +++++++++++++++++------- LiteEditor/BuildTabView.hpp | 6 +++--- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/LiteEditor/BuildTabView.cpp b/LiteEditor/BuildTabView.cpp index 1b3d5073c3..be94685858 100644 --- a/LiteEditor/BuildTabView.cpp +++ b/LiteEditor/BuildTabView.cpp @@ -362,7 +362,7 @@ void BuildTabView::OnNextBuildError(wxCommandEvent& event) ++from; } clDEBUG() << "searching error from line:" << from << endl; - SelectFirstErrorOrWarning(from, m_jumpThroughErrorsOnly); + SelectFirstErrorOrWarning(from, m_onlyErrors); } void BuildTabView::OnNextBuildErrorUI(wxUpdateUIEvent& event) { event.Enable(m_warnCount || m_errorCount); } @@ -392,14 +392,24 @@ BuildTabView::GetNextLineWithErrorOrWarning(size_t from, bool errors_only) const clDEBUG() << "Empty line info" << endl; return {}; } + auto iter = m_lineInfo.lower_bound(from); - if (iter == m_lineInfo.end()) { - clDEBUG() << "Could not find an error / warning info for line >=" << from << endl; - return {}; + while (iter != m_lineInfo.end()) { + switch (iter->second->match_pattern.sev) { + case Compiler::kSevWarning: + case Compiler::kSevNote: + if (errors_only) { + // items are sorted, move forward to the next match + ++iter; + continue; + } + // fall through + case Compiler::kSevError: + clDEBUG() << "Found:" << iter->second->message << endl; + return *iter; + } } - - clDEBUG() << "Found:" << iter->second->message << endl; - return *iter; + return {}; } void BuildTabView::ClearLineMarker() { MarkerDeleteAll(LINE_MARKER); } diff --git a/LiteEditor/BuildTabView.hpp b/LiteEditor/BuildTabView.hpp index daec1dfcf6..5503a91868 100644 --- a/LiteEditor/BuildTabView.hpp +++ b/LiteEditor/BuildTabView.hpp @@ -37,11 +37,11 @@ class BuildTabView : public wxStyledTextCtrl /// Initialise the view, preparing it for the next build process. This method should be called when a new build /// is starting - void Initialise(CompilerPtr compiler, bool jump_through_errors_only) + void Initialise(CompilerPtr compiler, bool only_erros) { Clear(); m_activeCompiler = compiler; // maybe null - m_jumpThroughErrorsOnly = jump_through_errors_only; + m_onlyErrors = only_erros; } size_t GetErrorCount() const { return m_errorCount; } @@ -68,7 +68,7 @@ class BuildTabView : public wxStyledTextCtrl private: std::map> m_lineInfo; CompilerPtr m_activeCompiler; - bool m_jumpThroughErrorsOnly = false; + bool m_onlyErrors = false; size_t m_errorCount = 0; size_t m_warnCount = 0; wxString m_currentProject;