From 377a379554eb3e7974a54268013120afd6550ff1 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Tue, 4 Jul 2023 17:19:29 +0800 Subject: [PATCH] fix: highlight for #define is not correct --- RedPandaIDE/mainwindow.cpp | 2 +- libs/qsynedit/qsynedit/syntaxer/cpp.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index b578e13e..da1cbb1c 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -102,7 +102,7 @@ static int findTabIndex(QTabWidget* tabWidget , QWidget* w) { for (int i=0;icount();i++) { if (w==tabWidget->widget(i)) return i; - } + } return -1; } diff --git a/libs/qsynedit/qsynedit/syntaxer/cpp.cpp b/libs/qsynedit/qsynedit/syntaxer/cpp.cpp index 0f4a3fef..a89e644d 100644 --- a/libs/qsynedit/qsynedit/syntaxer/cpp.cpp +++ b/libs/qsynedit/qsynedit/syntaxer/cpp.cpp @@ -467,7 +467,11 @@ void CppSyntaxer::procDefineIdent() while(mRun < mLineSize && isIdentChar(mLine[mRun])) mRun++; - mRange.state = RangeState::rsDefineRemaining; + + if (mRun=mLineSize) { mRange.hasTrailingSpaces = true; - if (mRange.state==RangeState::rsCppComment) + if (mRange.state==RangeState::rsCppComment + || mRange.state == RangeState::rsDefineRemaining) mRange.state = RangeState::rsUnknown; } }