diff --git a/src/NotepadNext/DockedEditor.cpp b/src/NotepadNext/DockedEditor.cpp index e11da7205..9e6b4771c 100644 --- a/src/NotepadNext/DockedEditor.cpp +++ b/src/NotepadNext/DockedEditor.cpp @@ -146,14 +146,7 @@ void DockedEditor::dockWidgetCloseRequested() ads::CDockAreaWidget *DockedEditor::currentDockArea() const { - const ads::CDockWidget *dockWidget = dockManager->focusedDockWidget(); - - if (dockWidget) { - return dockWidget->dockAreaWidget(); - } - else { - return Q_NULLPTR; - } + return dockManager->focusedDockWidget() ? dockManager->focusedDockWidget()->dockAreaWidget() : latestDockArea; } void DockedEditor::addEditor(ScintillaNext *editor) @@ -167,7 +160,7 @@ void DockedEditor::addEditor(ScintillaNext *editor) } // Create the dock widget for the editor - ads::CDockWidget *dockWidget = new ads::CDockWidget(editor->getName()); + ads::CDockWidget *dockWidget = dockManager->createDockWidget(editor->getName()); // Disable elide, elided file names not readable when lots of files opened dockWidget->tabWidget()->setElideMode(Qt::ElideNone); @@ -215,7 +208,7 @@ void DockedEditor::addEditor(ScintillaNext *editor) connect(dockWidget, &ads::CDockWidget::closeRequested, this, &DockedEditor::dockWidgetCloseRequested); - dockManager->addDockWidget(ads::CenterDockWidgetArea, dockWidget, currentDockArea()); + latestDockArea = dockManager->addDockWidget(ads::CenterDockWidgetArea, dockWidget, currentDockArea()); emit editorAdded(editor); } diff --git a/src/NotepadNext/DockedEditor.h b/src/NotepadNext/DockedEditor.h index bcaead68c..f70ac2c0b 100644 --- a/src/NotepadNext/DockedEditor.h +++ b/src/NotepadNext/DockedEditor.h @@ -31,6 +31,7 @@ class DockedEditor : public QObject private: ads::CDockManager* dockManager = Q_NULLPTR; + ads::CDockAreaWidget* latestDockArea = Q_NULLPTR; ScintillaNext *currentEditor = Q_NULLPTR; public: diff --git a/src/ads b/src/ads index 5edbcc197..df1fa2712 160000 --- a/src/ads +++ b/src/ads @@ -1 +1 @@ -Subproject commit 5edbcc1970bc8858ad09a41f4c3ac1700e489c8b +Subproject commit df1fa271274be04f9704f6d67eb2294c03256208