Skip to content

Commit 4832562

Browse files
fix(docking): preserve dock tab placement
Keep workspace and AI panels in their intended tab stacks so switching between them does not unexpectedly hide the active panel. - Permit workspace docks in any area used by existing layouts. - Avoid raising a matching workspace dock when it shares the AI dock's tab stack.
1 parent b88e603 commit 4832562

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/dialogs/MainWindow.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2666,7 +2666,6 @@ void MainWindow::openFolderAsWorkspacePath(const QString &dir, bool showGitTab)
26662666
dock->setObjectName(QStringLiteral("FolderAsWorkspaceDock_extra_%1").arg(++extraIdx));
26672667
dock->setAttribute(Qt::WA_DeleteOnClose, true);
26682668

2669-
addDockWidget(Qt::LeftDockWidgetArea, dock);
26702669
DockMiddleClickCloser::install(dock);
26712670
ui->menuView->addAction(dock->toggleViewAction());
26722671
connect(dock, &FolderAsWorkspaceDock::fileDoubleClicked, this, &MainWindow::openFile);
@@ -2675,7 +2674,10 @@ void MainWindow::openFolderAsWorkspacePath(const QString &dir, bool showGitTab)
26752674
registerWorkspaceDock(dock);
26762675

26772676
if (anchor) {
2677+
addDockWidget(Qt::LeftDockWidgetArea, dock);
26782678
tabifyDockWidget(anchor, dock);
2679+
} else {
2680+
addDockWidget(Qt::LeftDockWidgetArea, dock);
26792681
}
26802682

26812683
if (isSsh) {
@@ -5430,6 +5432,10 @@ void MainWindow::attachAiAgentDock(AiAgentDock *dock, bool raise)
54305432
return;
54315433
for (auto *ws : findChildren<FolderAsWorkspaceDock *>()) {
54325434
if (QDir::cleanPath(ws->rootPath()) == aiCwd) {
5435+
// Skip raise if the workspace is tabified with this AI dock —
5436+
// raising it would immediately hide the AI dock we just switched to.
5437+
if (tabifiedDockWidgets(ws).contains(dock))
5438+
break;
54335439
ws->setVisible(true);
54345440
ws->raise();
54355441
break;
@@ -5447,8 +5453,8 @@ void MainWindow::attachAiAgentDock(AiAgentDock *dock, bool raise)
54475453

54485454
connect(dock, &AiAgentDock::inputFocused, this, syncWorkspaceForDock);
54495455

5450-
addDockWidget(AiAgentDock::defaultArea(), dock);
54515456
DockMiddleClickCloser::install(dock);
5457+
addDockWidget(AiAgentDock::defaultArea(), dock);
54525458
if (existing) {
54535459
tabifyDockWidget(existing, dock);
54545460
} else {

src/docks/FolderAsWorkspaceDock.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ FolderAsWorkspaceDock::FolderAsWorkspaceDock(QWidget *parent) :
112112
tooltipTimer(new QTimer(this))
113113
{
114114
ui->setupUi(this);
115+
setAllowedAreas(Qt::AllDockWidgetAreas);
115116

116117
fsModel = model;
117118
proxy->setSourceModel(model);
@@ -184,6 +185,7 @@ FolderAsWorkspaceDock::FolderAsWorkspaceDock(const QString &initialPath, QWidget
184185
tooltipTimer(new QTimer(this))
185186
{
186187
ui->setupUi(this);
188+
setAllowedAreas(Qt::AllDockWidgetAreas);
187189

188190
fsModel = model;
189191
proxy->setSourceModel(model);

0 commit comments

Comments
 (0)