diff --git a/NEWS.md b/NEWS.md index 28ac5571..10573cf1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -115,6 +115,8 @@ Red Panda C++ Version 2.27 - enhancement: Set shortcuts for tools menu item. - enhancement: Enhancement for custom tools. - fix: Can't correctly undo/redo "Delete current line". + - fix: Breakpoint condition expression that contains spaces doesn't work. + - enhancement: Double click on breakpoint table's condition cell to modify it. Red Panda C++ Version 2.26 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/debugger/gdbmidebugger.cpp b/RedPandaIDE/debugger/gdbmidebugger.cpp index 94639287..78f00f9e 100644 --- a/RedPandaIDE/debugger/gdbmidebugger.cpp +++ b/RedPandaIDE/debugger/gdbmidebugger.cpp @@ -1107,7 +1107,7 @@ void GDBMIDebuggerClient::addBreakpoint(PBreakpoint breakpoint) // break "filename":linenum QString condition; if (!breakpoint->condition.isEmpty()) { - condition = " -c " + breakpoint->condition; + condition = QString(" -c \"%1\"").arg(breakpoint->condition); } QString filename = breakpoint->filename; filename.replace('\\','/'); @@ -1145,7 +1145,7 @@ void GDBMIDebuggerClient::setBreakpointCondition(PBreakpoint breakpoint) QString("%1").arg(breakpoint->number)); } else { postCommand("-break-condition", - QString("%1 %2").arg(breakpoint->number).arg(condition)); + QString("%1 \"%2\"").arg(breakpoint->number).arg(condition)); } } diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 77c11946..682e0420 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -208,6 +208,8 @@ MainWindow::MainWindow(QWidget *parent) delete m; ui->tblBreakpoints->setTextElideMode(Qt::ElideRight); ui->tblBreakpoints->setWordWrap(false); + connect(ui->tblBreakpoints, &QTableView::doubleClicked, + this, &MainWindow::onBreakpointTableDoubleClicked); m=ui->tblStackTrace->selectionModel(); ui->tblStackTrace->setModel(mDebugger->backtraceModel().get()); @@ -3016,7 +3018,7 @@ void MainWindow::createCustomActions() tr("Breakpoint condition..."), ui->tblBreakpoints); connect(mBreakpointViewPropertyAction,&QAction::triggered, - this, &MainWindow::onBreakpointViewProperty); + this, &MainWindow::onModifyBreakpointCondition); mBreakpointViewRemoveAllAction = createAction( tr("Remove All Breakpoints"), @@ -4815,6 +4817,13 @@ void MainWindow::onDebugConsoleClear() } } +void MainWindow::onBreakpointTableDoubleClicked(const QModelIndex &index) +{ + if (index.isValid() && index.column()==2) { + modifyBreakpointCondition(index.row()); + } +} + void MainWindow::onFilesViewOpenInExplorer() { QString path = mFileSystemModel.filePath(ui->treeFiles->currentIndex()); @@ -5079,25 +5088,11 @@ void MainWindow::onBreakpointViewRemoveAll() } } -void MainWindow::onBreakpointViewProperty() +void MainWindow::onModifyBreakpointCondition() { int index =ui->tblBreakpoints->selectionModel()->currentIndex().row(); - PBreakpoint breakpoint = debugger()->breakpointModel()->breakpoint( - index, - debugger()->isForProject() - ); - if (breakpoint) { - bool isOk; - QString s=QInputDialog::getText(this, - tr("Break point condition"), - tr("Enter the condition of the breakpoint:"), - QLineEdit::Normal, - breakpoint->condition,&isOk); - if (isOk) { - pMainWindow->debugger()->setBreakPointCondition(index,s,debugger()->isForProject()); - } - } + modifyBreakpointCondition(index); } void MainWindow::onSearchViewClearAll() @@ -7835,6 +7830,26 @@ QString MainWindow::switchHeaderSourceTarget(Editor *editor) return QString(); } +void MainWindow::modifyBreakpointCondition(int index) +{ + PBreakpoint breakpoint = debugger()->breakpointModel()->breakpoint( + index, + debugger()->isForProject() + ); + if (breakpoint) { + bool isOk; + QString s=QInputDialog::getText(this, + tr("Break point condition"), + tr("Enter the condition of the breakpoint:"), + QLineEdit::Normal, + breakpoint->condition,&isOk); + if (isOk) { + debugger()->setBreakPointCondition(index,s,debugger()->isForProject()); + } + } + +} + void MainWindow::setupSlotsForProject() { connect(mProject.get(), &Project::unitAdded, diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 428f5f95..898bdbb8 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -333,6 +333,8 @@ private: void reparseNonProjectEditors(); QString switchHeaderSourceTarget(Editor *editor); + void modifyBreakpointCondition(int index); + private slots: void setupSlotsForProject(); void onProjectUnitAdded(const QString &filename); @@ -400,6 +402,7 @@ private slots: void onDebugConsoleSelectAll(); void onDebugConsoleCopy(); void onDebugConsoleClear(); + void onBreakpointTableDoubleClicked(const QModelIndex& index); void onFilesViewOpenInExplorer(); void onFilesViewOpenInTerminal(); void onFilesViewOpenWithExternal(); @@ -421,7 +424,7 @@ private slots: void onProjectRenameUnit(); void onBreakpointRemove(); void onBreakpointViewRemoveAll(); - void onBreakpointViewProperty(); + void onModifyBreakpointCondition(); void onSearchViewClearAll(); void onSearchViewClear(); void onTableIssuesClear();