diff --git a/NEWS.md b/NEWS.md index a43845e6..50d9aaf2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,6 +9,8 @@ Red Panda C++ Version 3.2 - fix: Crash in windows 7. (by CyanoHao) - fix: While Control is pressed, can't start Drag&Drop by mouse. - enhancement: Auto detect gdb ACP (by CyanoHao) + - fix: When debugging project, the executing source file is not auto switched to. (#476) + Red Panda C++ Version 3.1 diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 5f5c5e41..b3eec1c5 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -608,11 +608,12 @@ void Editor::setFilename(const QString &newName) return; } -void Editor::activate() +void Editor::activate(bool focus) { if (mParentPageControl) mParentPageControl->setCurrentWidget(this); - setFocus(); + if (focus) + setFocus(); } const QByteArray& Editor::encodingOption() const noexcept{ diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index 4ac05111..ff12070e 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -150,7 +150,7 @@ public: bool save(bool force=false, bool reparse=true); bool saveAs(const QString& name="", bool fromProject = false); void setFilename(const QString& newName); - void activate(); + void activate(bool focus=true); QTabWidget* pageControl() noexcept; void setPageControl(QTabWidget* newPageControl); diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index b2bda0a0..eee23fae 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1163,6 +1163,7 @@ void MainWindow::setActiveBreakpoint(QString fileName, int Line, bool setFocus) Editor *e = openFile(fileName, false); if (e!=nullptr) { e->setActiveBreakpointFocus(Line,setFocus); + e->activate(false); if (setFocus) { activateWindow(); }