From 2fffe33bb7a31dd783f5463a3a2aefd2cc02580d Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Thu, 25 Nov 2021 23:41:40 +0800 Subject: [PATCH] - fix: the last line in the debug console is not correctly displayed --- NEWS.md | 1 + RedPandaIDE/debugger.cpp | 24 +++++++++++++++++------- RedPandaIDE/mainwindow.cpp | 4 +++- RedPandaIDE/widgets/qconsole.cpp | 2 +- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/NEWS.md b/NEWS.md index a215f6d8..31e757f0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ Version 0.10.1 For Dev-C++ 7 Beta - fix: can't correctly expand watch expression that has spaces in it - fix: can't correctly display stl containers in watch + - fix: the last line in the debug console is not correctly displayed Version 0.10.0 For Dev-C++ 7 Beta - enhancement: use gdb/mi interface to communicate with gdb debug session diff --git a/RedPandaIDE/debugger.cpp b/RedPandaIDE/debugger.cpp index d8f51560..f4018667 100644 --- a/RedPandaIDE/debugger.cpp +++ b/RedPandaIDE/debugger.cpp @@ -467,8 +467,18 @@ void Debugger::syncFinishedParsing() pMainWindow->addDebugOutput(line); } } else { - for (const QString& line:mReader->consoleOutput()) { - pMainWindow->addDebugOutput(line); + if (mReader->currentCmd() && mReader->currentCmd()->command == "disas") { + + } else { + for (const QString& line:mReader->consoleOutput()) { + pMainWindow->addDebugOutput(line); + } + if ( + (mReader->currentCmd() + && mReader->currentCmd()->source== DebugCommandSource::Console) + || !mReader->consoleOutput().isEmpty() ) { + pMainWindow->addDebugOutput("(gdb)"); + } } } } @@ -851,7 +861,8 @@ void DebugReader::processDebugOutput(const QByteArray& debugOutput) for (int i=0;idebugger().showDetailLog()) + mFullOutput.append(line); line = removeToken(line); if (line.isEmpty()) { continue; @@ -924,9 +935,8 @@ void DebugReader::runNextCmd() // if devDebugger.ShowCommandLog or pCmd^.ShowInConsole then begin if (pSettings->debugger().enableDebugConsole() ) { //update debug console - if (!pSettings->debugger().showDetailLog()) { - emit changeDebugConsoleLastLine(pCmd->command + ' ' + params); - } else { + if (pSettings->debugger().showDetailLog() + && pCmd->source != DebugCommandSource::Console) { emit changeDebugConsoleLastLine(pCmd->command + ' ' + params); } } @@ -1333,7 +1343,7 @@ void DebugReader::run() } else if (!mCmdRunning && readed.isEmpty()){ runNextCmd(); } else if (readed.isEmpty()){ - msleep(100); + msleep(1); } } if (errorOccurred) { diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 82183287..f7fab347 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -741,6 +741,8 @@ void MainWindow::updateAppTitle() void MainWindow::addDebugOutput(const QString &text) { + if (!pSettings->debugger().enableDebugConsole()) + return; if (text.isEmpty()) { ui->debugConsole->addLine(""); } else { @@ -1572,7 +1574,7 @@ void MainWindow::prepareDebugger() // Clear logs ui->debugConsole->clear(); - if (!pSettings->debugger().enableDebugConsole()) { + if (pSettings->debugger().enableDebugConsole()) { ui->debugConsole->addLine("(gdb) "); } ui->txtEvalOutput->clear(); diff --git a/RedPandaIDE/widgets/qconsole.cpp b/RedPandaIDE/widgets/qconsole.cpp index e1d06ffa..97a0210a 100644 --- a/RedPandaIDE/widgets/qconsole.cpp +++ b/RedPandaIDE/widgets/qconsole.cpp @@ -276,7 +276,7 @@ void QConsole::setTopRow(int value) int QConsole::maxScrollHeight() { - return std::max(mContents.rows()-mRowsInWindow,1); + return std::max(mContents.rows()-mRowsInWindow+1,1); } void QConsole::updateScrollbars()