Bug 389869

Summary: After deletion of selected files current item moves one down
Product: [Applications] krusader Reporter: Peter Mühlenpfordt <devel>
Component: generalAssignee: Krusader Bugs Distribution List <krusader-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: krusader-bugs-null, toni.asensi
Priority: NOR    
Version: 2.6.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Panel before/after deletion of selected files

Description Peter Mühlenpfordt 2018-02-04 12:21:42 UTC
Created attachment 110331 [details]
Panel before/after deletion of selected files

After deleting one or more selected files and current item is not one of these, the current item is moved one down.

Steps to reproduce:
1. Create a folder with 5 files "file1".."file5"
2. Select "file1" and "file2"
3. Set current item to "file3"
4. Press Del and delete selected files

Expected: Current item should stay on "file3"

What happens: Current item is moved down to "file4"

Tested with Krusader v2.6.0 from Kubuntu 17.10 packages and current master from git.
Comment 1 Toni Asensi Esteve 2018-02-04 17:57:58 UTC
Thanks, Peter. 

This didn't happen using Krusader 2.4.0-beta3.
Comment 2 Toni Asensi Esteve 2018-02-08 13:46:43 UTC
Note: This is related to
    https://phabricator.kde.org/D10385
Comment 3 Peter Mühlenpfordt 2018-02-14 06:48:37 UTC
Git commit dc38f3cfc6fd4477231967c03ea7fe76581d4e4c by Peter Mühlenpfordt.
Committed on 14/02/2018 at 06:48.
Pushed by muhlenpfordt into branch 'master'.

Fix setting new current item after file deletion

Summary:
After deleting one or more selected files and current item is not one
of these, the current item is moved one down.
This patch modifies `KrView::firstUnmarkedBelowCurrent()` to not make
an additional step down in finding the next unselected item.

Test Plan:
1. Create a folder with 5 files "file1".."file5"
2. Select "file1" and "file2"
3. Set current item to "file3"
4. Press {key Del} and delete selected files
-> The current item should stay on "file3"

Reviewers: #krusader, martinkostolny

Reviewed By: #krusader, martinkostolny

Subscribers: martinkostolny, asensi

Differential Revision: https://phabricator.kde.org/D10385

M  +4    -2    krusader/Panel/PanelView/krview.cpp
M  +1    -1    krusader/Panel/PanelView/krview.h
M  +2    -1    krusader/Panel/listpanel.cpp

https://commits.kde.org/krusader/dc38f3cfc6fd4477231967c03ea7fe76581d4e4c