diff --git a/NEWS.md b/NEWS.md index 5f3f9533..56320fb6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -18,6 +18,8 @@ Red Panda C++ Version 2.12 - change: The default disassemble style of CPU Dialog is "AT&T" now. - fix: Can't compile files with chinese characters in filenames using winlibs mingw gcc - fix: If current editor is empty, parser will parse the file's content on the disk instead from the editor. + - fix: Can't show completion when cursor is after "char[" + - change: Don't confirm rebuild/recompile when run/debug. Red Panda C++ Version 2.11 diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 29dc7d2e..7dfa610d 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -367,7 +367,6 @@ bool Editor::saveAs(const QString &name, bool fromProject){ QString selectedFileFilter; QString defaultExt; defaultExt=QFileInfo(oldName).suffix(); - qDebug()<editor().defaultFileCpp()) { selectedFileFilter = pSystemConsts->defaultCPPFileFilter(); @@ -4654,7 +4653,7 @@ QString Editor::getPreviousWordAtPositionForSuggestion(const QSynedit::BufferCoo QString s = document()->getLine(p.line - 1); int wordBegin; - int wordEnd = p.ch-1; + int wordEnd = p.ch-2; if (wordEnd >= s.length()) wordEnd = s.length()-1; while (true) { diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 0c8c7859..fffdbe4d 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1974,12 +1974,7 @@ void MainWindow::runExecutable( // Check if it exists if (!fileExists(exeName)) { if (ui->actionCompile_Run->isEnabled()) { - if (QMessageBox::question(this,tr("Confirm"), - tr("Source file is not compiled.") - +"

"+tr("Compile now?"), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - doCompileRun(runType); - } + doCompileRun(runType); return; } else { QMessageBox::critical(this,"Error", @@ -1988,18 +1983,8 @@ void MainWindow::runExecutable( } } else { if (!filename.isEmpty() && compareFileModifiedTime(filename,exeName)>=0) { -// if (ui->actionCompile_Run->isEnabled()) { - if (QMessageBox::warning(this,tr("Confirm"), - tr("Source file is more recent than executable.") - +"

"+tr("Recompile now?"), - QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { - doCompileRun(runType); - return; - } -// } else { -// QMessageBox::warning(this,"Error", -// tr("Source file is more recent than executable.")); -// } + doCompileRun(runType); + return; } } @@ -2044,12 +2029,7 @@ void MainWindow::runExecutable(RunType runType) QStringList binDirs = mProject->binDirs(); QFileInfo execInfo(mProject->executable()); QDateTime execModTime = execInfo.lastModified(); - if (execInfo.exists() && mProject->modifiedSince(execModTime) && - QMessageBox::question( - this, - tr("Rebuild Project"), - tr("Project has been modified, do you want to rebuild it?") - ) == QMessageBox::Yes) { + if (execInfo.exists() && mProject->modifiedSince(execModTime)) { //mProject->saveAll(); mCompileSuccessionTask=std::make_shared(); mCompileSuccessionTask->type = CompileSuccessionTaskType::RunNormal; @@ -2138,30 +2118,18 @@ void MainWindow::debug() // Did we compile? if (!fileExists(mProject->executable())) { - if (QMessageBox::question( - this, - tr("Project not built"), - tr("Project hasn't been built. Build it now?"), - QMessageBox::Yes | QMessageBox::No, - QMessageBox::Yes) == QMessageBox::Yes) { - mCompileSuccessionTask=std::make_shared(); - mCompileSuccessionTask->type = CompileSuccessionTaskType::Debug; - mCompileSuccessionTask->execName = mProject->executable(); - mCompileSuccessionTask->isExecutable = true; - mCompileSuccessionTask->binDirs = binDirs; - compile(); - } + mCompileSuccessionTask=std::make_shared(); + mCompileSuccessionTask->type = CompileSuccessionTaskType::Debug; + mCompileSuccessionTask->execName = mProject->executable(); + mCompileSuccessionTask->isExecutable = true; + mCompileSuccessionTask->binDirs = binDirs; + compile(); return; } { QFileInfo execInfo(mProject->executable()); QDateTime execModTime = execInfo.lastModified(); - if (execInfo.exists() && mProject->modifiedSince(execModTime) && - QMessageBox::question( - this, - tr("Rebuild Project"), - tr("Project has been modified, do you want to rebuild it?") - ) == QMessageBox::Yes) { + if (execInfo.exists() && mProject->modifiedSince(execModTime)) { //mProject->saveAll(); mCompileSuccessionTask=std::make_shared(); mCompileSuccessionTask->type = CompileSuccessionTaskType::Debug; @@ -5592,35 +5560,41 @@ void MainWindow::onCompileFinished(QString filename, bool isCheckSyntax) if (!isCheckSyntax) { //run succession task if there aren't any errors if (mCompileSuccessionTask && mCompilerManager->compileErrorCount()==0) { + if (!fileExists(mCompileSuccessionTask->execName)) { + QMessageBox::critical(this,tr("Compile Failed"), + tr("Failed to generate the executable.")+"

" + +tr("Please check detail info in \"Tools Output\" panel.")); + + return; + } if (!mCompileSuccessionTask->isExecutable) { + Editor * editor; switch (mCompileSuccessionTask->type) { case MainWindow::CompileSuccessionTaskType::RunNormal: - 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;idocument()->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 = openFile(mCompileSuccessionTask->execName); + if (e && editor) { + int line = e->caretY(); + int startLine = 1; + QString s = " # "+e->filename()+":"; + for(int i=0;idocument()->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); } + editor->setCaretPositionAndActivate(startLine,1); } break; case MainWindow::CompileSuccessionTaskType::RunProblemCases: diff --git a/Red_Panda_CPP.pro b/Red_Panda_CPP.pro index a7a8b684..1f2fe1a9 100644 --- a/Red_Panda_CPP.pro +++ b/Red_Panda_CPP.pro @@ -80,6 +80,7 @@ win32: { QMAKE_SUBSTITUTES += platform/windows/installer-scripts/config-clang.nsh.in resources.path = $${PREFIX} + resources.files += platform/windows/templates resources.files += platform/windows/installer-scripts/config.nsh resources.files += platform/windows/installer-scripts/config32.nsh @@ -90,5 +91,11 @@ win32: { resources.files += RedPandaIDE/images/devcpp.ico INSTALLS += resources + + equals(X86_64, "ON") { + extra_templates.path = $${PREFIX}/templates + extra_templates.files += platform/windows/templates-win64/* + INSTALLS += extra_templates + } } } diff --git a/packages/msys/build-x64.sh b/packages/msys/build-x64.sh index 2cf4315c..b4bc0fea 100644 --- a/packages/msys/build-x64.sh +++ b/packages/msys/build-x64.sh @@ -20,7 +20,7 @@ echo "Building..." pushd . cd "${BUILD_DIR}" make distclean -"$QMAKE" PREFIX="${PACKAGE_DIR}" -o Makefile "${SOURCE_DIR}\Red_Panda_Cpp.pro" -r -spec win32-g++ +"$QMAKE" PREFIX="${PACKAGE_DIR}" X86_64=ON -o Makefile "${SOURCE_DIR}\Red_Panda_Cpp.pro" -r -spec win32-g++ make -j16 make install popd diff --git a/platform/windows/templates/GAS_C/app.ico b/platform/windows/templates-win64/GAS_C/app.ico similarity index 100% rename from platform/windows/templates/GAS_C/app.ico rename to platform/windows/templates-win64/GAS_C/app.ico diff --git a/platform/windows/templates/GAS_C/info.template b/platform/windows/templates-win64/GAS_C/info.template similarity index 100% rename from platform/windows/templates/GAS_C/info.template rename to platform/windows/templates-win64/GAS_C/info.template diff --git a/platform/windows/templates/GAS_C/main.cpp b/platform/windows/templates-win64/GAS_C/main.cpp similarity index 100% rename from platform/windows/templates/GAS_C/main.cpp rename to platform/windows/templates-win64/GAS_C/main.cpp diff --git a/platform/windows/templates/GAS_C/utils.s b/platform/windows/templates-win64/GAS_C/utils.s similarity index 100% rename from platform/windows/templates/GAS_C/utils.s rename to platform/windows/templates-win64/GAS_C/utils.s diff --git a/platform/windows/templates/Hello_GAS/app.ico b/platform/windows/templates-win64/Hello_GAS/app.ico similarity index 100% rename from platform/windows/templates/Hello_GAS/app.ico rename to platform/windows/templates-win64/Hello_GAS/app.ico diff --git a/platform/windows/templates/Hello_GAS/info.template b/platform/windows/templates-win64/Hello_GAS/info.template similarity index 100% rename from platform/windows/templates/Hello_GAS/info.template rename to platform/windows/templates-win64/Hello_GAS/info.template diff --git a/platform/windows/templates/Hello_GAS/main.s b/platform/windows/templates-win64/Hello_GAS/main.s similarity index 73% rename from platform/windows/templates/Hello_GAS/main.s rename to platform/windows/templates-win64/Hello_GAS/main.s index 5005cfe7..20b0a580 100644 --- a/platform/windows/templates/Hello_GAS/main.s +++ b/platform/windows/templates-win64/Hello_GAS/main.s @@ -5,10 +5,8 @@ main: # the x64 calling convention requires you to allocate 32 bytes of shadow space before each call # https://stackoverflow.com/questions/30190132/what-is-the-shadow-space-in-x64-assembly/ sub $32, %rsp # allocate shadow space - leaq fmt(%rip), %rax # first parameter - movq %rax, %rcx - leaq msg(%rip), %rax # second parameter - movq %rax, %rdx + leaq fmt(%rip), %rcx # first parameter + leaq msg(%rip), %rdx # second parameter call printf add $32, %rsp # remove shadow space diff --git a/platform/windows/templates/Hello_NASM/app.ico b/platform/windows/templates-win64/Hello_NASM/app.ico similarity index 100% rename from platform/windows/templates/Hello_NASM/app.ico rename to platform/windows/templates-win64/Hello_NASM/app.ico diff --git a/platform/windows/templates/Hello_NASM/info.template b/platform/windows/templates-win64/Hello_NASM/info.template similarity index 100% rename from platform/windows/templates/Hello_NASM/info.template rename to platform/windows/templates-win64/Hello_NASM/info.template diff --git a/platform/windows/templates/Hello_NASM/main.asm b/platform/windows/templates-win64/Hello_NASM/main.asm similarity index 86% rename from platform/windows/templates/Hello_NASM/main.asm rename to platform/windows/templates-win64/Hello_NASM/main.asm index eb53051d..53958bfc 100644 --- a/platform/windows/templates/Hello_NASM/main.asm +++ b/platform/windows/templates-win64/Hello_NASM/main.asm @@ -11,8 +11,8 @@ main: ; the x64 calling convention requires you to allocate 32 bytes of shadow space before each call ; https://stackoverflow.com/questions/30190132/what-is-the-shadow-space-in-x64-assembly/ sub rsp, 32 ; allocate shadow space - mov rcx, fmt ; first parameter - mov rdx, msg ; secodng parameter + lea rcx, [rel fmt] ; first parameter + lea rdx, [rel msg] ; secodng parameter call printf add rsp,32 ; remove shadow space diff --git a/platform/windows/templates/NASM_C/app.ico b/platform/windows/templates-win64/NASM_C/app.ico similarity index 100% rename from platform/windows/templates/NASM_C/app.ico rename to platform/windows/templates-win64/NASM_C/app.ico diff --git a/platform/windows/templates/NASM_C/info.template b/platform/windows/templates-win64/NASM_C/info.template similarity index 100% rename from platform/windows/templates/NASM_C/info.template rename to platform/windows/templates-win64/NASM_C/info.template diff --git a/platform/windows/templates/NASM_C/main.cpp b/platform/windows/templates-win64/NASM_C/main.cpp similarity index 100% rename from platform/windows/templates/NASM_C/main.cpp rename to platform/windows/templates-win64/NASM_C/main.cpp diff --git a/platform/windows/templates/NASM_C/utils.asm b/platform/windows/templates-win64/NASM_C/utils.asm similarity index 100% rename from platform/windows/templates/NASM_C/utils.asm rename to platform/windows/templates-win64/NASM_C/utils.asm