From e58adc94ff0c9a16af8ad6889e0cd98e8c392d8f Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Thu, 28 Mar 2024 10:16:28 +0800 Subject: [PATCH] - 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 --- NEWS.md | 1 + RedPandaIDE/compiler/projectcompiler.cpp | 16 +++++++++------- RedPandaIDE/compiler/sdccprojectcompiler.cpp | 1 + RedPandaIDE/editor.cpp | 14 +++++++------- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/NEWS.md b/NEWS.md index b21fc8f1..df82397a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 ) - change: Don't turn on the code format option "indent class" by default. - 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 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/compiler/projectcompiler.cpp b/RedPandaIDE/compiler/projectcompiler.cpp index 863a5f8f..5f2b45ac 100644 --- a/RedPandaIDE/compiler/projectcompiler.cpp +++ b/RedPandaIDE/compiler/projectcompiler.cpp @@ -171,7 +171,7 @@ void ProjectCompiler::writeMakeHeader(QFile &file) void ProjectCompiler::writeMakeDefines(QFile &file, bool &genModuleDef) { // Get list of object files - QStringList Objects; + QStringList objects; QStringList LinkObjects; QStringList cleanObjects; QStringList moduleDefines; @@ -192,13 +192,13 @@ void ProjectCompiler::writeMakeDefines(QFile &file, bool &genModuleDef) QString fullObjFile = includeTrailingPathDelimiter(mProject->options().objectOutput) + extractFileName(unit->fileName()); QString relativeObjFile = extractRelativePath(mProject->directory(), changeFileExt(fullObjFile, OBJ_EXT)); - Objects << relativeObjFile; + objects << relativeObjFile; cleanObjects << localizePath(relativeObjFile); if (unit->link()) { LinkObjects << relativeObjFile; } } else { - Objects << changeFileExt(relativeName, OBJ_EXT); + objects << changeFileExt(relativeName, OBJ_EXT); cleanObjects << localizePath(changeFileExt(relativeName, OBJ_EXT)); if (unit->link()) LinkObjects << changeFileExt(relativeName, OBJ_EXT); @@ -253,7 +253,7 @@ void ProjectCompiler::writeMakeDefines(QFile &file, bool &genModuleDef) QString executable = extractRelativePath(mProject->makeFileName(), mProject->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); // 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 if (!objResFile.isEmpty()) { writeln(file, "RES = " + escapeFilenameForMakefilePrerequisite(objResFile)); - writeln(file, "OBJ = " + escapeFilenamesForMakefilePrerequisite(Objects) + " $(RES)"); + writeln(file, "OBJ = " + escapeFilenamesForMakefilePrerequisite(objects) + " $(RES)"); } else { - writeln(file, "OBJ = " + escapeFilenamesForMakefilePrerequisite(Objects)); + writeln(file, "OBJ = " + escapeFilenamesForMakefilePrerequisite(objects)); }; writeln(file, "BIN = " + escapeFilenameForMakefilePrerequisite(executable)); if (mProject->options().usePrecompiledHeader && fileExists(mProject->options().precompiledHeader)){ - writeln(file, "PCH_H = " + escapeFilenameForMakefilePrerequisite(pchH)); + writeln(file, "PCH_H = " + escapeFilenameForMakefilePrerequisite(pchHeader)); writeln(file, "PCH = " + escapeFilenameForMakefilePrerequisite(pch)); } @@ -625,6 +625,8 @@ bool ProjectCompiler::prepareForCompile() } mDirectory = mProject->directory(); + mOutputFile = mProject->executable(); + log(tr("Processing makefile:")); log("--------"); log(tr("- makefile processer: %1").arg(mCompiler)); diff --git a/RedPandaIDE/compiler/sdccprojectcompiler.cpp b/RedPandaIDE/compiler/sdccprojectcompiler.cpp index 9aa3db7a..0d52f2c9 100644 --- a/RedPandaIDE/compiler/sdccprojectcompiler.cpp +++ b/RedPandaIDE/compiler/sdccprojectcompiler.cpp @@ -341,6 +341,7 @@ bool SDCCProjectCompiler::prepareForCompile() } mDirectory = mProject->directory(); + mOutputFile = mProject->executable(); log(tr("Processing makefile:")); log("--------"); log(tr("- makefile processer: %1").arg(mCompiler)); diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index bb52a808..e5bd2633 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1875,22 +1875,22 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes) // scSelection includes anything caret related if (changes.testFlag(QSynedit::StatusChange::scSelection)) { - QString token; - QSynedit::PTokenAttribute attri; - if (getTokenAttriAtRowCol(caretXY(), token,attri) + if (!selAvail() && pSettings->editor().highlightCurrentWord()) { + QString token; + QSynedit::PTokenAttribute attri; + if (getTokenAttriAtRowCol(caretXY(), token,attri) && ( (attri->tokenType()==QSynedit::TokenType::Identifier) || (attri->tokenType() == QSynedit::TokenType::Keyword) || (attri->tokenType() == QSynedit::TokenType::Preprocessor) )) { - if (!selAvail() && pSettings->editor().highlightCurrentWord()) { mCurrentHighlightedWord = token; - } else if (selAvail() && blockBegin() == wordStart() - && blockEnd() == wordEnd()){ - mCurrentHighlightedWord = selText(); } else { mCurrentHighlightedWord = ""; } + } else if (selAvail() && blockBegin() == wordStart() + && blockEnd() == wordEnd()){ + mCurrentHighlightedWord = selText(); } else { mCurrentHighlightedWord = ""; }