From e51473fddebea67af1e84c0a5ce8d3b1d42fe36a Mon Sep 17 00:00:00 2001 From: royqh1979 Date: Wed, 20 Oct 2021 18:22:06 +0800 Subject: [PATCH] - fix: don't highlight '#' with spaces preceeding it as error --- NEWS.md | 1 + RedPandaIDE/qsynedit/highlighter/cpp.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) 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;