- fix: Compile info for project doesn't have name of the project executable.

- fix: Select a word in string / comment doesn't highlight other words in the file
This commit is contained in:
Roy Qu 2024-03-28 10:16:28 +08:00
parent 76d3e3d6e2
commit e58adc94ff
4 changed files with 18 additions and 14 deletions

View File

@ -102,6 +102,7 @@ Red Panda C++ Version 2.27
- fix: "0x3.12p+1" is treadted as a plus expression when reformatting code. ( by 绣球135@qq - fix: "0x3.12p+1" is treadted as a plus expression when reformatting code. ( by 绣球135@qq
- change: Don't turn on the code format option "indent class" by default. - change: Don't turn on the code format option "indent class" by default.
- enhancement: Add compiler set by choose the executable. - enhancement: Add compiler set by choose the executable.
- fix: Compile info for project doesn't have name of the project executable.
Red Panda C++ Version 2.26 Red Panda C++ Version 2.26
- enhancement: Code suggestion for embedded std::vectors. - enhancement: Code suggestion for embedded std::vectors.

View File

@ -171,7 +171,7 @@ void ProjectCompiler::writeMakeHeader(QFile &file)
void ProjectCompiler::writeMakeDefines(QFile &file, bool &genModuleDef) void ProjectCompiler::writeMakeDefines(QFile &file, bool &genModuleDef)
{ {
// Get list of object files // Get list of object files
QStringList Objects; QStringList objects;
QStringList LinkObjects; QStringList LinkObjects;
QStringList cleanObjects; QStringList cleanObjects;
QStringList moduleDefines; QStringList moduleDefines;
@ -192,13 +192,13 @@ void ProjectCompiler::writeMakeDefines(QFile &file, bool &genModuleDef)
QString fullObjFile = includeTrailingPathDelimiter(mProject->options().objectOutput) QString fullObjFile = includeTrailingPathDelimiter(mProject->options().objectOutput)
+ extractFileName(unit->fileName()); + extractFileName(unit->fileName());
QString relativeObjFile = extractRelativePath(mProject->directory(), changeFileExt(fullObjFile, OBJ_EXT)); QString relativeObjFile = extractRelativePath(mProject->directory(), changeFileExt(fullObjFile, OBJ_EXT));
Objects << relativeObjFile; objects << relativeObjFile;
cleanObjects << localizePath(relativeObjFile); cleanObjects << localizePath(relativeObjFile);
if (unit->link()) { if (unit->link()) {
LinkObjects << relativeObjFile; LinkObjects << relativeObjFile;
} }
} else { } else {
Objects << changeFileExt(relativeName, OBJ_EXT); objects << changeFileExt(relativeName, OBJ_EXT);
cleanObjects << localizePath(changeFileExt(relativeName, OBJ_EXT)); cleanObjects << localizePath(changeFileExt(relativeName, OBJ_EXT));
if (unit->link()) if (unit->link())
LinkObjects << changeFileExt(relativeName, OBJ_EXT); LinkObjects << changeFileExt(relativeName, OBJ_EXT);
@ -253,7 +253,7 @@ void ProjectCompiler::writeMakeDefines(QFile &file, bool &genModuleDef)
QString executable = extractRelativePath(mProject->makeFileName(), mProject->executable()); QString executable = extractRelativePath(mProject->makeFileName(), mProject->executable());
QString cleanExe = localizePath(executable); QString cleanExe = localizePath(executable);
QString pchH = extractRelativePath(mProject->makeFileName(), mProject->options().precompiledHeader); QString pchHeader = extractRelativePath(mProject->makeFileName(), mProject->options().precompiledHeader);
QString pch = extractRelativePath(mProject->makeFileName(), mProject->options().precompiledHeader + "." GCH_EXT); QString pch = extractRelativePath(mProject->makeFileName(), mProject->options().precompiledHeader + "." GCH_EXT);
// programs // programs
@ -278,14 +278,14 @@ void ProjectCompiler::writeMakeDefines(QFile &file, bool &genModuleDef)
// do not use them in targets or command arguments, they have different escaping rules // do not use them in targets or command arguments, they have different escaping rules
if (!objResFile.isEmpty()) { if (!objResFile.isEmpty()) {
writeln(file, "RES = " + escapeFilenameForMakefilePrerequisite(objResFile)); writeln(file, "RES = " + escapeFilenameForMakefilePrerequisite(objResFile));
writeln(file, "OBJ = " + escapeFilenamesForMakefilePrerequisite(Objects) + " $(RES)"); writeln(file, "OBJ = " + escapeFilenamesForMakefilePrerequisite(objects) + " $(RES)");
} else { } else {
writeln(file, "OBJ = " + escapeFilenamesForMakefilePrerequisite(Objects)); writeln(file, "OBJ = " + escapeFilenamesForMakefilePrerequisite(objects));
}; };
writeln(file, "BIN = " + escapeFilenameForMakefilePrerequisite(executable)); writeln(file, "BIN = " + escapeFilenameForMakefilePrerequisite(executable));
if (mProject->options().usePrecompiledHeader if (mProject->options().usePrecompiledHeader
&& fileExists(mProject->options().precompiledHeader)){ && fileExists(mProject->options().precompiledHeader)){
writeln(file, "PCH_H = " + escapeFilenameForMakefilePrerequisite(pchH)); writeln(file, "PCH_H = " + escapeFilenameForMakefilePrerequisite(pchHeader));
writeln(file, "PCH = " + escapeFilenameForMakefilePrerequisite(pch)); writeln(file, "PCH = " + escapeFilenameForMakefilePrerequisite(pch));
} }
@ -625,6 +625,8 @@ bool ProjectCompiler::prepareForCompile()
} }
mDirectory = mProject->directory(); mDirectory = mProject->directory();
mOutputFile = mProject->executable();
log(tr("Processing makefile:")); log(tr("Processing makefile:"));
log("--------"); log("--------");
log(tr("- makefile processer: %1").arg(mCompiler)); log(tr("- makefile processer: %1").arg(mCompiler));

View File

@ -341,6 +341,7 @@ bool SDCCProjectCompiler::prepareForCompile()
} }
mDirectory = mProject->directory(); mDirectory = mProject->directory();
mOutputFile = mProject->executable();
log(tr("Processing makefile:")); log(tr("Processing makefile:"));
log("--------"); log("--------");
log(tr("- makefile processer: %1").arg(mCompiler)); log(tr("- makefile processer: %1").arg(mCompiler));

View File

@ -1875,22 +1875,22 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes)
// scSelection includes anything caret related // scSelection includes anything caret related
if (changes.testFlag(QSynedit::StatusChange::scSelection)) { if (changes.testFlag(QSynedit::StatusChange::scSelection)) {
QString token; if (!selAvail() && pSettings->editor().highlightCurrentWord()) {
QSynedit::PTokenAttribute attri; QString token;
if (getTokenAttriAtRowCol(caretXY(), token,attri) QSynedit::PTokenAttribute attri;
if (getTokenAttriAtRowCol(caretXY(), token,attri)
&& ( && (
(attri->tokenType()==QSynedit::TokenType::Identifier) (attri->tokenType()==QSynedit::TokenType::Identifier)
|| (attri->tokenType() == QSynedit::TokenType::Keyword) || (attri->tokenType() == QSynedit::TokenType::Keyword)
|| (attri->tokenType() == QSynedit::TokenType::Preprocessor) || (attri->tokenType() == QSynedit::TokenType::Preprocessor)
)) { )) {
if (!selAvail() && pSettings->editor().highlightCurrentWord()) {
mCurrentHighlightedWord = token; mCurrentHighlightedWord = token;
} else if (selAvail() && blockBegin() == wordStart()
&& blockEnd() == wordEnd()){
mCurrentHighlightedWord = selText();
} else { } else {
mCurrentHighlightedWord = ""; mCurrentHighlightedWord = "";
} }
} else if (selAvail() && blockBegin() == wordStart()
&& blockEnd() == wordEnd()){
mCurrentHighlightedWord = selText();
} else { } else {
mCurrentHighlightedWord = ""; mCurrentHighlightedWord = "";
} }