fix: highlight for #define is not correct

This commit is contained in:
Roy Qu 2023-07-04 17:19:29 +08:00
parent 70edbf7054
commit 377a379554
2 changed files with 8 additions and 3 deletions

View File

@ -102,7 +102,7 @@ static int findTabIndex(QTabWidget* tabWidget , QWidget* w) {
for (int i=0;i<tabWidget->count();i++) { for (int i=0;i<tabWidget->count();i++) {
if (w==tabWidget->widget(i)) if (w==tabWidget->widget(i))
return i; return i;
} }
return -1; return -1;
} }

View File

@ -467,7 +467,11 @@ void CppSyntaxer::procDefineIdent()
while(mRun < mLineSize && isIdentChar(mLine[mRun])) while(mRun < mLineSize && isIdentChar(mLine[mRun]))
mRun++; mRun++;
mRange.state = RangeState::rsDefineRemaining;
if (mRun<mLineSize)
mRange.state = RangeState::rsDefineRemaining;
else
mRange.state = RangeState::rsUnknown;
} }
void CppSyntaxer::procDefineRemaining() void CppSyntaxer::procDefineRemaining()
@ -1031,7 +1035,8 @@ void CppSyntaxer::procSpace()
mRun+=1; mRun+=1;
if (mRun>=mLineSize) { if (mRun>=mLineSize) {
mRange.hasTrailingSpaces = true; mRange.hasTrailingSpaces = true;
if (mRange.state==RangeState::rsCppComment) if (mRange.state==RangeState::rsCppComment
|| mRange.state == RangeState::rsDefineRemaining)
mRange.state = RangeState::rsUnknown; mRange.state = RangeState::rsUnknown;
} }
} }