- fix: rename macro doesn't work in project

This commit is contained in:
Roy Qu 2022-06-12 18:26:39 +08:00
parent e0442dcca4
commit 2182553fe1
4 changed files with 56 additions and 29 deletions

View File

@ -7,6 +7,7 @@ Red Panda C++ Version 1.1.0
- enhancement: rename in files view's context menu
- enhancement: delete in files view's context menu
- change: drag&drop in files view default to move
- fix: rename macro doesn't work in project
Red Panda C++ Version 1.0.10
- fix: modify watch doesn't work

View File

@ -4175,7 +4175,6 @@ void MainWindow::onFileChanged(const QString &path)
mFilesChangedNotifying.insert(path);
Editor *e = mEditorList->getOpenedEditorByFilename(path);
if (e) {
e->setModified(true);
if (fileExists(path)) {
e->activate();
if (QMessageBox::question(this,tr("File Changed"),
@ -4187,6 +4186,8 @@ void MainWindow::onFileChanged(const QString &path)
} catch(FileError e) {
QMessageBox::critical(this,tr("Error"),e.reason());
}
} else {
e->setModified(true);
}
} else {
mFileSystemWatcher.removePath(path);
@ -4197,7 +4198,6 @@ void MainWindow::onFileChanged(const QString &path)
mEditorList->closeEditor(e);
} else {
e->setModified(true);
e->updateCaption();
}
}
}

View File

@ -451,6 +451,25 @@ void SynEditCppHighlighter::directiveProc()
mRun+=1;
}
if (directive == "define") {
while(mLine[mRun]!=0 && isSpaceChar(mLine[mRun]))
mRun++;
mRange.state = RangeState::rsDefineIdentifier;
return;
} else
mRange.state = RangeState::rsUnknown;
}
void SynEditCppHighlighter::defineIdentProc()
{
mTokenId = TokenKind::Identifier;
while(mLine[mRun]!=0 && isIdentChar(mLine[mRun]))
mRun++;
mRange.state = RangeState::rsDefineRemaining;
}
void SynEditCppHighlighter::defineRemainingProc()
{
mTokenId = TokenKind::Directive;
do {
switch(mLine[mRun].unicode()) {
case '/': //comment?
@ -473,8 +492,7 @@ void SynEditCppHighlighter::directiveProc()
}
mRun+=1;
} while (mLine[mRun]!=0);
} else
mRange.state = RangeState::rsUnknown;
mRange.state=RangeState::rsUnknown;
}
void SynEditCppHighlighter::directiveEndProc()
@ -1518,6 +1536,12 @@ void SynEditCppHighlighter::next()
asciiCharProc();
}
break;
case RangeState::rsDefineIdentifier:
defineIdentProc();
break;
case RangeState::rsDefineRemaining:
defineRemainingProc();
break;
default:
mRange.state = RangeState::rsUnknown;
if (mLine[mRun] == 'R' && mLine[mRun+1] == '"') {

View File

@ -62,7 +62,7 @@ class SynEditCppHighlighter: public SynHighlighter
rsMultiLineString, rsMultiLineDirective, rsCppComment,
rsStringEscapeSeq, rsMultiLineStringEscapeSeq,
rsRawString, rsSpace,rsRawStringEscaping,rsRawStringNotEscaping,rsChar,
rsCppCommentEnded
rsCppCommentEnded, rsDefineStart, rsDefineIdentifier, rsDefineRemaining
};
public:
@ -111,6 +111,8 @@ private:
void colonProc();
void commaProc();
void directiveProc();
void defineIdentProc();
void defineRemainingProc();
void directiveEndProc();
void equalProc();
void greaterProc();