- fix: Escape suquences like \uxxxx and \Uxxxxxxxx in strings are not correctly highlighted.

This commit is contained in:
Roy Qu 2022-11-11 09:00:06 +08:00
parent 36f94bbb33
commit 1dbc0972ab
3 changed files with 11 additions and 4 deletions

View File

@ -19,6 +19,7 @@ Red Panda C++ Version 2.4
- fix: Layout for project options dialog's general page is not correct.
- fix: modifitions in the project options dialogs's dll host page is not correctly saved.
- enhancement: In the project options dialog, autoset the default folder in the openning dialog when choosing file/directory paths.
- fix: Escape suquences like \uxxxx and \Uxxxxxxxx in strings are not correctly highlighted.
Red Panda C++ Version 2.3

View File

@ -783,9 +783,7 @@ void Editor::keyPressEvent(QKeyEvent *event)
return;
}
}
qDebug()<<"lalalala";
lastWord = getPreviousWordAtPositionForCompleteFunctionDefinition(caretXY());
qDebug()<<lastWord;
if (!lastWord.isEmpty()) {
PStatement currentScope = mParser->findScopeStatement(mFilename,caretY());
while(currentScope && currentScope->kind==StatementKind::skBlock) {

View File

@ -1174,7 +1174,11 @@ void CppHighlighter::stringEscapeSeqProc()
case 'u':
mRun+=1;
for (int i=0;i<4;i++) {
if (mRun>=mLineSize || mLine[mRun]<'0' || mLine[mRun]>'7') {
if (mRun>=mLineSize || !(
(mLine[mRun]>='0' && mLine[mRun]<='9')
|| (mLine[mRun]>='a' && mLine[mRun]<='f')
|| (mLine[mRun]>='A' && mLine[mRun]<='F')
)) {
mTokenId = TokenId::Unknown;
return;
}
@ -1184,7 +1188,11 @@ void CppHighlighter::stringEscapeSeqProc()
case 'U':
mRun+=1;
for (int i=0;i<8;i++) {
if (mRun>=mLineSize || mLine[mRun]<'0' || mLine[mRun]>'7') {
if (mRun>=mLineSize || !(
(mLine[mRun]>='0' && mLine[mRun]<='9')
|| (mLine[mRun]>='a' && mLine[mRun]<='f')
|| (mLine[mRun]>='A' && mLine[mRun]<='F')
)) {
mTokenId = TokenId::Unknown;
return;
}