- fix: Can't suggest header filename starting with numbers.

This commit is contained in:
Roy Qu 2023-08-14 22:37:34 +08:00
parent fbef3b4f29
commit bbdefc4af0
3 changed files with 34 additions and 7 deletions

View File

@ -30,6 +30,7 @@ Red Panda C++ Version 2.24
- enhancement: Support sdcc compiler.
- enhancement: Autowrap tool output text.
- fix: Press up/down arrow key in the option dialog's left panel won't switch page.
- fix: Can't suggest header filename starting with numbers.
Red Panda C++ Version 2.23

View File

@ -961,7 +961,13 @@ void Editor::keyPressEvent(QKeyEvent *event)
} else {
if (pSettings->codeCompletion().enabled()
&& pSettings->codeCompletion().showCompletionWhileInput() ) {
if (syntaxer() && syntaxer()->language()==QSynedit::ProgrammingLanguage::CPP) {
if (mParser && mParser->isIncludeLine(lineText())) {
// is a #include line
processCommand(QSynedit::EditCommand::Char,ch,nullptr);
showHeaderCompletion(false);
handled=true;
return;
} else if (syntaxer() && syntaxer()->language()==QSynedit::ProgrammingLanguage::CPP) {
//preprocessor ?
if ((idCharPressed==0) && (ch=='#') && lineText().isEmpty()) {
processCommand(QSynedit::EditCommand::Char,ch,nullptr);

View File

@ -2348,6 +2348,19 @@ QStringList Settings::CompilerSet::defines(bool isCpp) {
arguments.append("c");
arguments.append("-V");
key=SDCC_CMD_OPT_PROCESSOR;
//language standard
PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerType(), key);
if (pOption) {
if (!mCompileOptions[key].isEmpty())
arguments.append(pOption->setting + mCompileOptions[key]);
}
key=SDCC_CMD_OPT_STD;
//language standard
pOption = CompilerInfoManager::getCompilerOption(compilerType(), key);
if (pOption) {
if (!mCompileOptions[key].isEmpty())
arguments.append(pOption->setting + mCompileOptions[key]);
}
} else {
#endif
if (isCpp) {
@ -2357,15 +2370,16 @@ QStringList Settings::CompilerSet::defines(bool isCpp) {
arguments.append("c");
key=C_CMD_OPT_STD;
}
//language standard
PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerType(), key);
if (pOption) {
if (!mCompileOptions[key].isEmpty())
arguments.append(pOption->setting + mCompileOptions[key]);
}
#ifdef ENABLE_SDCC
}
#endif
//language standard
PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerType(), key);
if (pOption) {
if (!mCompileOptions[key].isEmpty())
arguments.append(pOption->setting + mCompileOptions[key]);
}
arguments.append(NULL_FILE);
@ -2610,6 +2624,12 @@ void Settings::CompilerSet::setSDCCDirectories(const QString& binDir)
QStringList arguments;
arguments.clear();
arguments.append("--print-search-dirs");
QString key = SDCC_CMD_OPT_PROCESSOR;
PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerType(), key);
if (pOption) {
if (!mCompileOptions[key].isEmpty())
arguments.append(pOption->setting + mCompileOptions[key]);
}
QByteArray output = getCompilerOutput(binDir,c_prog,arguments);
//bindirs