Created attachment 135903 [details] Screen capture showing folder expansion SUMMARY When in Detail view sorted by ascending size: clicking on the arrow to expand a folder will sometimes show the folders files under a folder further down the list. STEPS TO REPRODUCE 1. Set Dolphin to detail view 2. Navigate to a folder with many sub-folders 3. Sort by ascending size 4. Click on an arrow to expand a folder 5. If the folder expands normally, click again to collapse, then click the arrow on the following folder. OBSERVED RESULT For some folders the files will show as the contents of another folder further down the list. (please see attached screen cap) EXPECTED RESULT Every expanded folder should show it contents directly below it. SOFTWARE/OS VERSIONS Linux/KDE Plasma: KDE Plasma Version: 5.20.5 KDE Frameworks Version: 5.78.0 Qt Version: 5.15.2 ADDITIONAL INFORMATION This seems to happen more in folders with lots of sub-folders.
I can also reproduce it but I can reproduce the same behaviour both for ascending and descending ordering according to size. The number of folders/files does not need to be high. It can be reproduced with three folders with three files in each. Furthermore sometimes (when are folders ordered by size) it happens that seemingly random folders swap their places - for example: . ├── a ├── b ├── c ├── d └── e after expanding of "c": . ├── b ├── a ├── c │ ├── c1 │ ├── c2 │ ├── c3 │ └── c4 ├── d └── e System info: Operating System: Manjaro Linux KDE Plasma Version: 5.21.1 KDE Frameworks Version: 5.79.0 Qt Version: 5.15.2 Kernel Version: 5.10.18-1-MANJARO OS Type: 64-bit Graphics Platform: X11
Can you reproduce this on Arch as well.
(In reply to Christian Muehlhaeuser from comment #2) > Can you reproduce this on Arch as well. Sorry, I meant to say: "I can reproduce this on Arch as well."
Quickly fixed this and posted a PR ready for review: https://invent.kde.org/system/dolphin/-/merge_requests/232
Git commit baaf0c29b857997720b9cb0d584a44306963fb97 by Elvis Angelaccio, on behalf of Christian Muehlhaeuser. Committed on 13/07/2021 at 19:48. Pushed by elvisangelaccio into branch 'release/21.08'. Ensure stable sort order when sorting by size Folders with equal size caused the sort operation to become unstable, as the result of lessThan was non-deterministic. We need the fallback mechanisms at the bottom of the function to resovle the situation and provide a stable sort order. This also fixes expanding the contents of a folder into the wrong parent. FIXED-IN: 21.08 M +13 -5 src/kitemviews/kfileitemmodel.cpp https://invent.kde.org/system/dolphin/commit/baaf0c29b857997720b9cb0d584a44306963fb97