- enhancement: set caret to the corresponding line in the editor after "run"/"generate assembly"
- fix: syntax highlighting for cpp style line comment is not correct.
This commit is contained in:
parent
7503f553fc
commit
d8fae209c6
5
NEWS.md
5
NEWS.md
|
@ -1,3 +1,8 @@
|
|||
Red Panda C++ Version 2.9
|
||||
|
||||
- enhancement: set caret to the corresponding line in the editor after "run"/"generate assembly"
|
||||
- fix: syntax highlighting for cpp style line comment is not correct.
|
||||
|
||||
Red Panda C++ Version 2.8
|
||||
|
||||
- fix: Crash when editing makefile
|
||||
|
|
|
@ -5541,8 +5541,33 @@ void MainWindow::onCompileFinished(QString filename, bool isCheckSyntax)
|
|||
if (!mCompileSuccessionTask->isExecutable) {
|
||||
switch (mCompileSuccessionTask->type) {
|
||||
case MainWindow::CompileSuccessionTaskType::RunNormal:
|
||||
if (fileExists(mCompileSuccessionTask->execName))
|
||||
openFile(mCompileSuccessionTask->execName);
|
||||
if (fileExists(mCompileSuccessionTask->execName)) {
|
||||
Editor * editor = openFile(mCompileSuccessionTask->execName);
|
||||
if (e && editor) {
|
||||
int line = e->caretY();
|
||||
int startLine = 1;
|
||||
QString s = " # "+e->filename()+":";
|
||||
for(int i=0;i<editor->document()->count();i++) {
|
||||
QString t=editor->document()->getLine(i);
|
||||
if (t.startsWith(s,PATH_SENSITIVITY)) {
|
||||
t=t.mid(s.length());
|
||||
int pos = t.indexOf(":");
|
||||
if (pos>0) {
|
||||
QString numstring=t.mid(0,pos);
|
||||
bool isOk;
|
||||
int l=numstring.toInt(&isOk);
|
||||
if (isOk) {
|
||||
if (l<=line)
|
||||
startLine=i+1;
|
||||
if (l>=line)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
editor->setCaretPositionAndActivate(startLine,1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MainWindow::CompileSuccessionTaskType::RunProblemCases:
|
||||
case MainWindow::CompileSuccessionTaskType::RunCurrentProblemCase:
|
||||
|
|
|
@ -289,6 +289,10 @@ void CppSyntaxer::andSymbolProc()
|
|||
|
||||
void CppSyntaxer::ansiCppProc()
|
||||
{
|
||||
if (mRun>=mLineSize) {
|
||||
nullProc();
|
||||
return;
|
||||
}
|
||||
mTokenId = TokenId::Comment;
|
||||
while (mRun<mLineSize) {
|
||||
if (isSpaceChar(mLine[mRun]))
|
||||
|
@ -933,7 +937,10 @@ void CppSyntaxer::slashProc()
|
|||
case '/': // Cpp style comment
|
||||
mTokenId = TokenId::Comment;
|
||||
mRun+=2;
|
||||
mRange.state = RangeState::rsCppComment;
|
||||
if (mRun<mLineSize)
|
||||
mRange.state = RangeState::rsCppComment;
|
||||
else
|
||||
mRange.state = RangeState::rsUnknown;
|
||||
return;
|
||||
case '*': // C style comment
|
||||
mTokenId = TokenId::Comment;
|
||||
|
@ -976,8 +983,11 @@ void CppSyntaxer::spaceProc()
|
|||
mTokenId = TokenId::Space;
|
||||
while (mRun<mLineSize && mLine[mRun]>=1 && mLine[mRun]<=32)
|
||||
mRun+=1;
|
||||
if (mRun>=mLineSize)
|
||||
if (mRun>=mLineSize) {
|
||||
mRange.hasTrailingSpaces = true;
|
||||
if (mRange.state==RangeState::rsCppComment)
|
||||
mRange.state = RangeState::rsUnknown;
|
||||
}
|
||||
}
|
||||
|
||||
void CppSyntaxer::squareCloseProc()
|
||||
|
|
Loading…
Reference in New Issue