diff --git a/NEWS.md b/NEWS.md index d1db1e35..c30665c5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ Version 0.7.0 - enhancement: new file template - fix: when an editor is created, its caret will be displayed even it doesn't have focus - enhancement: set mouse wheel scroll speed in the editor general option tab ( 3 lines by default) + - fix: don't highlight '#' with spaces preceeding it as error Version 0.6.8 - enhancement: add link to cppreference in the help menu diff --git a/RedPandaIDE/qsynedit/highlighter/cpp.cpp b/RedPandaIDE/qsynedit/highlighter/cpp.cpp index e82f7fa4..56c688fa 100644 --- a/RedPandaIDE/qsynedit/highlighter/cpp.cpp +++ b/RedPandaIDE/qsynedit/highlighter/cpp.cpp @@ -409,7 +409,8 @@ void SynEditCppHighlighter::commaProc() void SynEditCppHighlighter::directiveProc() { - if (mLine[0]!='#') { // '#' is not first char on the line, treat it as an invalid char + QString preContents = mLineString.left(mRun).trimmed(); + if (!preContents.isEmpty()) { // '#' is not first non-space char on the line, treat it as an invalid char mTokenId = TokenKind::Unknown; mRun+=1; return;