- fix: the last line in the debug console is not correctly displayed

This commit is contained in:
Roy Qu 2021-11-25 23:41:40 +08:00
parent cbec8f60f4
commit 2fffe33bb7
4 changed files with 22 additions and 9 deletions

View File

@ -1,6 +1,7 @@
Version 0.10.1 For Dev-C++ 7 Beta 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 expand watch expression that has spaces in it
- fix: can't correctly display stl containers in watch - 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 Version 0.10.0 For Dev-C++ 7 Beta
- enhancement: use gdb/mi interface to communicate with gdb debug session - enhancement: use gdb/mi interface to communicate with gdb debug session

View File

@ -467,8 +467,18 @@ void Debugger::syncFinishedParsing()
pMainWindow->addDebugOutput(line); pMainWindow->addDebugOutput(line);
} }
} else { } else {
for (const QString& line:mReader->consoleOutput()) { if (mReader->currentCmd() && mReader->currentCmd()->command == "disas") {
pMainWindow->addDebugOutput(line);
} 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;i<lines.count();i++) { for (int i=0;i<lines.count();i++) {
QByteArray line = lines[i]; QByteArray line = lines[i];
mFullOutput.append(line); if (pSettings->debugger().showDetailLog())
mFullOutput.append(line);
line = removeToken(line); line = removeToken(line);
if (line.isEmpty()) { if (line.isEmpty()) {
continue; continue;
@ -924,9 +935,8 @@ void DebugReader::runNextCmd()
// if devDebugger.ShowCommandLog or pCmd^.ShowInConsole then begin // if devDebugger.ShowCommandLog or pCmd^.ShowInConsole then begin
if (pSettings->debugger().enableDebugConsole() ) { if (pSettings->debugger().enableDebugConsole() ) {
//update debug console //update debug console
if (!pSettings->debugger().showDetailLog()) { if (pSettings->debugger().showDetailLog()
emit changeDebugConsoleLastLine(pCmd->command + ' ' + params); && pCmd->source != DebugCommandSource::Console) {
} else {
emit changeDebugConsoleLastLine(pCmd->command + ' ' + params); emit changeDebugConsoleLastLine(pCmd->command + ' ' + params);
} }
} }
@ -1333,7 +1343,7 @@ void DebugReader::run()
} else if (!mCmdRunning && readed.isEmpty()){ } else if (!mCmdRunning && readed.isEmpty()){
runNextCmd(); runNextCmd();
} else if (readed.isEmpty()){ } else if (readed.isEmpty()){
msleep(100); msleep(1);
} }
} }
if (errorOccurred) { if (errorOccurred) {

View File

@ -741,6 +741,8 @@ void MainWindow::updateAppTitle()
void MainWindow::addDebugOutput(const QString &text) void MainWindow::addDebugOutput(const QString &text)
{ {
if (!pSettings->debugger().enableDebugConsole())
return;
if (text.isEmpty()) { if (text.isEmpty()) {
ui->debugConsole->addLine(""); ui->debugConsole->addLine("");
} else { } else {
@ -1572,7 +1574,7 @@ void MainWindow::prepareDebugger()
// Clear logs // Clear logs
ui->debugConsole->clear(); ui->debugConsole->clear();
if (!pSettings->debugger().enableDebugConsole()) { if (pSettings->debugger().enableDebugConsole()) {
ui->debugConsole->addLine("(gdb) "); ui->debugConsole->addLine("(gdb) ");
} }
ui->txtEvalOutput->clear(); ui->txtEvalOutput->clear();

View File

@ -276,7 +276,7 @@ void QConsole::setTopRow(int value)
int QConsole::maxScrollHeight() int QConsole::maxScrollHeight()
{ {
return std::max(mContents.rows()-mRowsInWindow,1); return std::max(mContents.rows()-mRowsInWindow+1,1);
} }
void QConsole::updateScrollbars() void QConsole::updateScrollbars()