diff --git a/NEWS.md b/NEWS.md index 397157af..b2524987 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,8 @@ Version 0.6.7 - - fix: debugger won't exit when the program has exited. + - fix: messages send to the gdb process's standard error are not received - adjust: the max value of the debug console's vertical scrollbar. + - fix: shfit+click not correctly set selection's end + - fix: ctrl+home/end not correctly set cursor to start/end of the editor Version 0.6.6 - fix: crash when create new file diff --git a/RedPandaIDE/debugger.cpp b/RedPandaIDE/debugger.cpp index a6fad45b..ba084daf 100644 --- a/RedPandaIDE/debugger.cpp +++ b/RedPandaIDE/debugger.cpp @@ -11,6 +11,7 @@ #include #include #include +#include Debugger::Debugger(QObject *parent) : QObject(parent) { @@ -660,8 +661,6 @@ AnnotationType DebugReader::getAnnotation(const QString &s) result = AnnotationType::TMemory; } return result; - } else if (s == "error") { - return AnnotationType::TError; } else if (s == "error-begin") { return AnnotationType::TErrorBegin; } else if (s == "error-end") { @@ -886,18 +885,6 @@ void DebugReader::handleError() } } -void DebugReader::handleErrorExit() -{ - if ((mCurrentCmd) && ( - mCurrentCmd->command == "next" - || mCurrentCmd->command == "step" - || mCurrentCmd->command == "finish" - || mCurrentCmd->command == "continue")) { - handleExit(); - } - -} - void DebugReader::handleExit() { doprocessexited=true; @@ -1200,9 +1187,6 @@ void DebugReader::processDebugOutput() case AnnotationType::TSignal: handleSignal(); break; - case AnnotationType::TError: - handleErrorExit(); - break; case AnnotationType::TExit: handleExit(); break; @@ -1637,16 +1621,19 @@ void DebugReader::run() mStop = false; bool errorOccurred = false; QString cmd = mDebuggerPath; +// QString arguments = "--annotate=2"; QString arguments = "--annotate=2 --silent"; QString workingDir = QFileInfo(mDebuggerPath).path(); mProcess = new QProcess(); mProcess->setProgram(cmd); mProcess->setArguments(QProcess::splitCommand(arguments)); + mProcess->setProcessChannelMode(QProcess::MergedChannels); QString cmdDir = extractFileDir(cmd); if (!cmdDir.isEmpty()) { QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QString path = env.value("PATH"); + cmdDir.replace("/",QDir::separator()); if (path.isEmpty()) { path = cmdDir; } else { @@ -1661,20 +1648,13 @@ void DebugReader::run() [&](){ errorOccurred= true; }); -// mProcess.connect(&process, &QProcess::readyReadStandardError,[&process,this](){ -// this->error(QString::fromLocal8Bit( process.readAllStandardError())); -// }); -// mProcess.connect(&mProcess, &QProcess::readyReadStandardOutput,[&process,this](){ -// this->log(QString::fromLocal8Bit( process.readAllStandardOutput())); -// }); -// process.connect(&mProcess, QOverload::of(&QProcess::finished),[&process,this](){ -// this->error(COMPILE_PROCESS_END); -// }); + QByteArray buffer; + QByteArray readed; + mProcess->start(); mProcess->waitForStarted(5000); mStartSemaphore.release(1); - QByteArray buffer; - QByteArray readed; + while (true) { mProcess->waitForFinished(1); if (mProcess->state()!=QProcess::Running) { diff --git a/RedPandaIDE/debugger.h b/RedPandaIDE/debugger.h index bd8d5740..687a414f 100644 --- a/RedPandaIDE/debugger.h +++ b/RedPandaIDE/debugger.h @@ -26,7 +26,6 @@ enum class AnnotationType { TFrameSourceFile, TFrameSourceBegin, TFrameSourceLine, TFrameFunctionName, TFrameWhere, TFrameArgs, TFrameBegin, TFrameEnd, - TError, TErrorBegin, TErrorEnd, TArrayBegin, TArrayEnd, TElt, TEltRep, TEltRepEnd, @@ -308,7 +307,6 @@ private: void handleDisassembly(); void handleDisplay(); void handleError(); - void handleErrorExit(); void handleExit(); void handleFrames(); void handleLocalOutput(); diff --git a/RedPandaIDE/qsynedit/KeyStrokes.cpp b/RedPandaIDE/qsynedit/KeyStrokes.cpp index 5b4a1d8f..76a4db58 100644 --- a/RedPandaIDE/qsynedit/KeyStrokes.cpp +++ b/RedPandaIDE/qsynedit/KeyStrokes.cpp @@ -185,12 +185,12 @@ void SynEditKeyStrokes::resetDefaults() add(SynEditorCommand::ecSelPageTop, Qt::Key_PageUp, Qt::ShiftModifier|Qt::ControlModifier); add(SynEditorCommand::ecLineStart, Qt::Key_Home, Qt::NoModifier); add(SynEditorCommand::ecSelLineStart, Qt::Key_Home, Qt::ShiftModifier); - add(SynEditorCommand::ecEditorTop, Qt::Key_Home, Qt::ControlModifier); - add(SynEditorCommand::ecSelEditorTop, Qt::Key_Home, Qt::ShiftModifier|Qt::ControlModifier); + add(SynEditorCommand::ecEditorStart, Qt::Key_Home, Qt::ControlModifier); + add(SynEditorCommand::ecSelEditorStart, Qt::Key_Home, Qt::ShiftModifier|Qt::ControlModifier); add(SynEditorCommand::ecLineEnd, Qt::Key_End, Qt::NoModifier); add(SynEditorCommand::ecSelLineEnd, Qt::Key_End, Qt::ShiftModifier); - add(SynEditorCommand::ecEditorBottom, Qt::Key_End, Qt::ControlModifier); - add(SynEditorCommand::ecSelEditorBottom, Qt::Key_End, Qt::ShiftModifier|Qt::ControlModifier); + add(SynEditorCommand::ecEditorEnd, Qt::Key_End, Qt::ControlModifier); + add(SynEditorCommand::ecSelEditorEnd, Qt::Key_End, Qt::ShiftModifier|Qt::ControlModifier); add(SynEditorCommand::ecToggleMode, Qt::Key_Insert, Qt::NoModifier); add(SynEditorCommand::ecCopy, Qt::Key_Insert, Qt::ControlModifier); add(SynEditorCommand::ecCut, Qt::Key_Delete, Qt::ShiftModifier); diff --git a/RedPandaIDE/qsynedit/KeyStrokes.h b/RedPandaIDE/qsynedit/KeyStrokes.h index c083c71d..a0ab8ea2 100644 --- a/RedPandaIDE/qsynedit/KeyStrokes.h +++ b/RedPandaIDE/qsynedit/KeyStrokes.h @@ -40,8 +40,8 @@ enum class SynEditorCommand { ecPageRight = 12, // Move cursor left one page ecPageTop = 13, // Move cursor to top of page ecPageBottom = 14, // Move cursor to bottom of page - ecEditorTop = 15, // Move cursor to absolute beginning - ecEditorBottom = 16, // Move cursor to absolute end + ecEditorStart = 15, // Move cursor to absolute beginning + ecEditorEnd = 16, // Move cursor to absolute end ecGotoXY = 17, // Move cursor to specific coordinates, Data = PPoint //****************************************************************************** @@ -67,8 +67,8 @@ enum class SynEditorCommand { ecSelPageRight = ecPageRight + ecSelection, ecSelPageTop = ecPageTop + ecSelection, ecSelPageBottom = ecPageBottom + ecSelection, - ecSelEditorTop = ecEditorTop + ecSelection, - ecSelEditorBottom = ecEditorBottom + ecSelection, + ecSelEditorStart = ecEditorStart + ecSelection, + ecSelEditorEnd = ecEditorEnd + ecSelection, ecSelGotoXY = ecGotoXY + ecSelection, // Data = PPoint ecSelWord = 198, diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 9d2c32bc..ff05f4c0 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -4953,14 +4953,17 @@ void SynEdit::ExecuteCommand(SynEditorCommand Command, QChar AChar, void *pData) case SynEditorCommand::ecSelPageBottom: moveCaretVert(mTopLine+mLinesInWindow-1-mCaretY, Command == SynEditorCommand::ecSelPageBottom); break; - case SynEditorCommand::ecEditorTop: - case SynEditorCommand::ecSelEditorTop: - moveCaretVert(1-mCaretY, Command == SynEditorCommand::ecSelEditorTop); + case SynEditorCommand::ecEditorStart: + case SynEditorCommand::ecSelEditorStart: + moveCaretVert(1-mCaretY, Command == SynEditorCommand::ecSelEditorStart); + moveCaretToLineStart(Command == SynEditorCommand::ecSelEditorStart); break; - case SynEditorCommand::ecEditorBottom: - case SynEditorCommand::ecSelEditorBottom: - if (!mLines->empty()) - moveCaretVert(mLines->count()-mCaretY, Command == SynEditorCommand::ecSelEditorBottom); + case SynEditorCommand::ecEditorEnd: + case SynEditorCommand::ecSelEditorEnd: + if (!mLines->empty()) { + moveCaretVert(mLines->count()-mCaretY, Command == SynEditorCommand::ecSelEditorEnd); + moveCaretToLineEnd(Command == SynEditorCommand::ecSelEditorStart); + } break; // goto special line / column position case SynEditorCommand::ecGotoXY: @@ -5517,8 +5520,8 @@ void SynEdit::mousePressEvent(QMouseEvent *event) //I couldn't track down why, but sometimes (and definitely not all the time) //the block positioning is lost. This makes sure that the block is //maintained in case they started a drag operation on the block - mBlockBegin = TmpBegin; - mBlockEnd = TmpEnd; +// setBlockBegin(TmpBegin); +// setBlockEnd(TmpEnd); setMouseTracking(true); //if mousedown occurred in selected block begin drag operation @@ -5530,19 +5533,19 @@ void SynEdit::mousePressEvent(QMouseEvent *event) if (bStartDrag) { mStateFlags.setFlag(SynStateFlag::sfWaitForDragging); } else { - if (event->modifiers() == Qt::ShiftModifier) + if (event->modifiers() == Qt::ShiftModifier) { //BlockBegin and BlockEnd are restored to their original position in the //code from above and SetBlockEnd will take care of proper invalidation setBlockEnd(caretXY()); - else if (mOptions.testFlag(eoAltSetsColumnMode) && + } else if (mOptions.testFlag(eoAltSetsColumnMode) && (mActiveSelectionMode != SynSelectionMode::smLine)) { if (event->modifiers() == Qt::AltModifier) setSelectionMode(SynSelectionMode::smColumn); else setSelectionMode(SynSelectionMode::smNormal); + //Selection mode must be set before calling SetBlockBegin + setBlockBegin(caretXY()); } - //Selection mode must be set before calling SetBlockBegin - setBlockBegin(caretXY()); } } } diff --git a/RedPandaIDE/systemconsts.h b/RedPandaIDE/systemconsts.h index 84c58a3d..d0748ad4 100644 --- a/RedPandaIDE/systemconsts.h +++ b/RedPandaIDE/systemconsts.h @@ -3,7 +3,7 @@ #include -#define DEVCPP_VERSION "0.6.6" +#define DEVCPP_VERSION "0.6.7" #ifdef Q_OS_WIN #define APP_SETTSINGS_FILENAME "redpandacpp.ini" diff --git a/RedPandaIDE/utils.h b/RedPandaIDE/utils.h index 2ceed232..bd34a4bb 100644 --- a/RedPandaIDE/utils.h +++ b/RedPandaIDE/utils.h @@ -190,6 +190,11 @@ int getNewFileNumber(); class CppParser; void resetCppParser(std::shared_ptr parser); + +/** + * from https://github.com/Microsoft/GSL + **/ + template class final_action {