diff --git a/krusader/Panel/PanelView/krview.h b/krusader/Panel/PanelView/krview.h --- a/krusader/Panel/PanelView/krview.h +++ b/krusader/Panel/PanelView/krview.h @@ -268,7 +268,7 @@ void invertSelection(); QString nameToMakeCurrent() const { return _nameToMakeCurrent; } void setNameToMakeCurrent(const QString name) { _nameToMakeCurrent = name; } - QString firstUnmarkedBelowCurrent(); + QString firstUnmarkedBelowCurrent(const bool skipCurrent); QString statistics(); const KrViewProperties *properties() const { return _properties; } KrViewOperator *op() const { return _operator; } diff --git a/krusader/Panel/PanelView/krview.cpp b/krusader/Panel/PanelView/krview.cpp --- a/krusader/Panel/PanelView/krview.cpp +++ b/krusader/Panel/PanelView/krview.cpp @@ -524,12 +524,14 @@ makeItemVisible(temp); } -QString KrView::firstUnmarkedBelowCurrent() +QString KrView::firstUnmarkedBelowCurrent(const bool skipCurrent) { if (getCurrentKrViewItem() == 0) return QString(); - KrViewItem * iterator = getNext(getCurrentKrViewItem()); + KrViewItem *iterator = getCurrentKrViewItem(); + if (skipCurrent) + iterator = getNext(iterator); while (iterator && iterator->isSelected()) iterator = getNext(iterator); if (!iterator) { diff --git a/krusader/Panel/listpanel.cpp b/krusader/Panel/listpanel.cpp --- a/krusader/Panel/listpanel.cpp +++ b/krusader/Panel/listpanel.cpp @@ -899,7 +899,8 @@ void ListPanel::prepareToDelete() { - view->setNameToMakeCurrent(view->firstUnmarkedBelowCurrent()); + const bool skipCurrent = (view->numSelected() == 0); + view->setNameToMakeCurrent(view->firstUnmarkedBelowCurrent(skipCurrent)); } void ListPanel::keyPressEvent(QKeyEvent *e)